1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

114850 Commits

Author SHA1 Message Date
Michael Niedermayer
57a22f0994
avutil/tests/dict: Check av_dict_set() before get for failure
Failure is possible due to strdup()

Fixes: CID1516764 Dereference null return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e8a1e1899d9ededd78f8ec4722fe80c345bbf8f7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:57 +02:00
Michael Niedermayer
447e9fea75
avdevice/dshow: fix badly indented line
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c4004605b2fa6e2ecbd1cfc2a1da382e4f5237a5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:57 +02:00
Michael Niedermayer
4b11e29881
avformat/demux: resurrect dead stores
Fixes: CID1473512 Unused value
Fixes: CID1529228 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 33da5f4e2717cc947cf44ad9a52668694ea4ee82)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:57 +02:00
Michael Niedermayer
d17dcd63b1
avcodec/tests/bitstream_template: Assert bits_init8() return
Helps: CID1518967 Unchecked return value
Helps: CID1518968 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e7775973f037724f26676015a364134fd728babf)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:56 +02:00
Michael Niedermayer
87f805613c
tools/enc_recon_frame_test: Assert that av_image_get_linesize() succeeds
Helps: CID1524598 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b6fa2ed77e57e82f3155b83ca4f4b3be8da5ff5c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:56 +02:00
James Almer
1ef18d0223 avformat/iamf_writer: disallow Opus extradata with mapping family other than 0
Clause 3.11.1 of IAMF[1] states the Opus ID Header should conform to  ChannelMappingFamily == 0.

[1]https://aomediacodec.github.io/iamf/#opus-specific

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 2aab4e4cc0b4a666c7e5a752b25a337710b20bdb)
2024-07-19 21:08:08 -03:00
James Almer
fdd3e3504e avformat/iamf_parse: sanitize audio_roll_distance values
Ensure the values are spec complaint and that no integer overflow can happen.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 9ce065c90decf1a07a810ccb699a491d41a720d2)
2024-07-19 21:08:08 -03:00
James Almer
db90c46fff avformat/iamf: byteswap values in OpusHeader
Clause 3.11.1 of IAMF[1] states the values are stored in big endian, in
contrast to the Ogg Encapsulation for Opus[2] where they are in little endian.

[1]https://aomediacodec.github.io/iamf/v1.0.0-errata.html#opus-specific
[2]https://datatracker.ietf.org/doc/html/rfc7845#section-5.1

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7dabad079b783e921747de96597ea47cab244a11)
2024-07-18 23:38:51 -03:00
James Almer
5fc5b33319 avformat/iamf: rename Codec Config seek_preroll to audio_roll_distance
The semantics for the field are different than the one in AVCodecParameters,
so use the name defined in the IAMF spec to prevent confusion.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 54b8d5e201c97464625cfb6cfd851ed80976aa44)
2024-07-18 23:38:04 -03:00
Felicia Lim
5e43483206 avformat/iamf_writer: fix coded audio_roll_distance values
'seek_preroll' corresponds to 'audio_roll_distance' in IAMF[1]

[1]https://aomediacodec.github.io/iamf/v1.0.0-errata.html#audio_roll_distance

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 2094f4029563d8fe5e62663bc04fc1f109448182)
2024-07-18 23:38:04 -03:00
Felicia Lim
df2d21a47b avformat/iamf_writer: fix PCM endian-ness flag
The value was swapped from what's defined in clause 3.11.4 of IAMF[1]

[1]https://aomediacodec.github.io/iamf/#lpcm-specific

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 709a5687ed13a153b7ccbe096c1fa8783733f1d9)
2024-07-18 23:38:04 -03:00
Felicia Lim
a3bc5cd841 avformat/movenc: fix channel count and samplerate fields for IAMF tracks
Clause 6.2.3 of IAMF[1] states both of these shall be set to 0.

[1]https://aomediacodec.github.io/iamf/v1.0.0-errata.html#iasampleentry-section

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 180c869faf96dbf1396fa3aba43b7488f9a7090b)
2024-07-18 23:38:04 -03:00
James Almer
507348799c avformat/iamf_parse: keep substream count consistent
Fixes: member access within null pointer of type 'IAMFSubStream' (aka 'struct IAMFSubStream')
Fixes: 69795/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6216287009701888

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b248dace929e97b10de17663caab32fbb1c42f0f)
2024-07-18 23:33:38 -03:00
James Almer
29d626ea85 avformat/iamf_parse: add missing padding to AAC extradata
Fixes: out of array access
Fixes: 68863/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-4833546039525376

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 0ae157b3603f27d8057febd8f2680ac1030722ee)
2024-07-18 23:33:38 -03:00
Michael Niedermayer
3d4d2897e6 avformat/iamf_parse: 0 layers are not allowed
Fixes: out of array access
Fixes: 68302/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4665793796177920

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7fab9b97613e5ec6954fb8118f9ca43f04847cfe)
2024-07-18 23:33:38 -03:00
Michael Niedermayer
ce939aa59a avformat/iamf_parse: consider nb_substreams when accessing substreams array
Fixes: out of array access
Fixes: 68584/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6256656668229632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c69e6cccd7e14fc6ee9df179f19e9de2cecba3d8)
2024-07-18 23:33:38 -03:00
Michael Niedermayer
fd789a087e avformat/iamf_parse: Remove dead case
Fixes: CID1559546 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c21fb3624bb7e10f9ee5a182bf9cfbf64990c78e)
2024-07-18 23:33:37 -03:00
Leo Izen
daffde0544
avcodec/png: more informative error message for invalid sBIT size
If the sBIT chunk size is invalid, we should print a more informative
error message rather than return an error and print nothing.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-07-18 21:39:39 -04:00
Leo Izen
b5d42852d0
avcodec/pngdec: avoid erroring with sBIT on indexed-color images
Indexed color images use three colors for sBIT, but the function
ff_png_get_nb_channels returns 1 in this case. We should avoid erroring
out on valid files in this scenario.

Regression since 84b454935fae2633a8a5dd075e22393f3e8f932f.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Ramiro Polla <ramiro.polla@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
2024-07-18 21:39:21 -04:00
James Almer
2df8aaa8c5 avfilter/vf_tiltandshift: fix buffer offset for yuv422p input
Fixes ticket #10950.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-06 11:19:51 -03:00
Marton Balint
c75cabef94 avutil/timestamp: avoid possible FPE when 0 is passed to av_ts_make_time_string2()
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 0d5e3f5a4034b6c9312b7c621e25aa4303a00b6f)
2024-07-05 21:55:14 +02:00
James Almer
28b1dbb4ee avformat/mov: add more checks for infe atom size
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-04 13:47:42 -03:00
James Almer
dc51d491cf avformat/mov: check for EOF inside the infe list parsing loop
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-04 13:47:42 -03:00
James Almer
fbe52bd65c avformat/mov: check extent_offset calculation for overflow
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-04 13:47:42 -03:00
James Almer
b44758d8e4 avformat/mov: check that iloc offset values fit on an int64_t
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-04 13:47:42 -03:00
Leo Izen
89a85efbf1
avcodec/pngenc: fix mDCv typo
When mDCv support was added, there was a typo in both variable names
and also the MKTAG itself, incorrectly listing it as mDVc. The tag name
stands for Mastering Display Color Volume so mDCv is correct.

Typo originally introduced in 78949041417caaef0c82b2b23d7defdd88aa2378.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Ramiro Polla <ramiro.polla@gmail.com>
2024-07-03 10:22:35 -04:00
Leo Izen
5ce0c37896
avcodec/pngdec: fix mDCv typo
When mDCv support was added, there was a typo in both variable names
and also the MKTAG itself, incorrectly listing it as mDVc. The tag name
stands for Mastering Display Color Volume so mDCv is correct. See other
files such as av1dec.c which uses mdcv.

Typo originally introduced in c7a57b0f70f8d1574aa0f0dbe98db85d8ac91c76.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reported-by: Ramiro Polla <ramiro.polla@gmail.com>
2024-07-03 10:22:32 -04:00
Josh Allmann
a7fa1049d7 avcodec/nvenc: fix segfault in intra-only mode
In intra-only mode, frameIntervalP is 0, which means the frame
data array is smaller than the number of surfaces.

Together with using the wrong size on deallocation of the
frame_data_array, this lead to a crash.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
(cherry picked from commit c9151ea50715c4ce47ad1c8df519781565db01f6)
2024-07-01 20:05:17 +02:00
Theo Fabi
40ddddca45 avdevice/avfoundation: add external video devices
Video devices categorized by AVFoundation as
'AVCaptureDeviceTypeExternal(Unknown)' (like USB video streams) were not
recognized by libavdevice.

Signed-off-by: Theo Fabi <fabi.theo@gmail.com>
2024-06-27 19:37:41 +02:00
Brad Smith
887e6f404d aarch64: Add OpenBSD runtime detection of dotprod and i8mm using sysctl
Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit 41190da9e11f536cb590df45ce9839974e5e6777)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-06-26 02:30:44 -04:00
Timo Rothenpieler
173673f359 fftools/ffplay_renderer: use correct NULL value for Vulkan type
(cherry picked from commit 6d4eba51f29b1755537afe31d992f5559a0b05b9)
2024-06-25 00:19:51 +02:00
Michael Niedermayer
0013970c68 qsv: Initialize impl_value
Fixes: The warnings from CID1598553 Uninitialized scalar variable

Passing partly initialized structs is ugly and asking for hard to rieproduce bugs,
The uninitialized fields where not used

Reviewed-by: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c841cb45e81ebece26768c820c459b085668a37a)
2024-06-24 00:10:37 +02:00
oltolm
647e983450 avutil/hwcontext_qsv: fix GCC 14.1 warnings
Tested-by: Tong Wu <tong1.wu@intel.com>
Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
(cherry picked from commit 45d31614bcc54c5ccbaabf07e7336ac477e2b424)
2024-06-24 00:10:37 +02:00
Zhao Zhili
f0b747ef1a avcodec/mediacodecenc: workaround the alignment requirement for H.265
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-31 20:11:13 +08:00
Zhao Zhili
edc7b57e26 avcodec/mediacodecenc: workaround the alignment requirement only for H.264
There is no bsf for other codecs to modify crop info except H.265.
For H.265, the assumption that FFALIGN(width, 16)xFFALIGN(height, 16)
is the video resolution can be wrong, since the encoder can use CTU
larger than 16x16. In that case, use FFALIGN(width, 16) - width
as crop_right is incorrect. So disable the workaround for H.265 now.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-31 20:11:13 +08:00
Rémi Denis-Courmont
449cab7b16 lavc/lpc: fix off-by-one in R-V V compute_autocorr
(cherry picked from commit af20fb9c4eb81383d4ef558d20af317e93b5acc8)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-28 19:47:04 +03:00
llyyr
1800213575
lavc/vp9: reset segmentation fields when segmentation isn't enabled
Fields under the segmentation switch are never reset on a new frame, and
retain the value from the previous frame. This bugs out a bunch of
hwaccel drivers when segmentation is disabled but update_map isn't
reset because they don't ignore values behind switches. This commit also
resets the temporal field, though it may not be required.

We also do this for vp8 [1] so this commit is just mirroring the vp8
logic.

This fixes an issue with certain samples [2] that causes blocky
artifacts with vaapi, d3d11va and cuda (and possibly others).
Mesa worked around [3] this by ignoring these fields if
segmentation.enabled is 0, but d3d11va still displays blocky artifacts.

[1] 2e877090f9:/libavcodec/vp8.c#l797
[2] https://github.com/mpv-player/mpv/issues/13533
[3] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27816

Signed-off-by: llyyr <llyyr.public@gmail.com>
2024-05-27 12:37:27 +02:00
Brad Smith
f42c35b7c9 configure: enable ffnvcodec, nvenc, nvdec for FreeBSD
Signed-off-by: Brad Smith <brad@comstyle.com>
(cherry picked from commit 43b1a956789bf0d5796769427d40c78e460c247f)
Signed-off-by: Brad Smith <brad@comstyle.com>
2024-05-26 19:42:22 -04:00
Rémi Denis-Courmont
58ac1f9ea8 lavc/sbrdsp: fix potential overflow in noise table
Since the SBR noise application optimisations are currently restricted
to hardware with 128-bit vectors, and use a quadruple multipler, they
can load up to 16 32-bit elements. But the "loads" are of 2 segments,
or 16 pairs of single precision float.

Thus we need to expand the dupiclated section of the noise table from
2x8 to 2x16 to avoid overflows.

(cherry picked from commit e6b38c944f0ed1f28f78fcf0055708c7d208db07)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-26 14:14:51 +03:00
Michael Niedermayer
af25a4bfd2
Update for FFmpeg 7.0.1 release
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
n7.0.1
2024-05-25 22:08:34 +02:00
Rémi Denis-Courmont
2d514f5d48 lavc/flacdsp: do not assume maximum R-V VL
This loop correctly assumes that VLMAX=16 (4x128-bit vectors
with 32-bit elements) and 32 >= pred_order > 16. We need to alternate
between VL=16 and VL=t2=pred_order-16 elements to add up to pred_order.

The current code requests AVL=a2=pred_order elements. In QEMU and on
thte K230 hardware, this sets VL=16 as we need. But the specification
merely guarantees that we get: ceil(AVL / 2) <= VL <= VLMAX. For
instance, if pred_order equals 27, we could end up with VL=14 or VL=15
instead of VL=16. So instead, request literally VLMAX=16.

(cherry picked from commit f8837465875205207bd281ecad9e4b9a12638c7e)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-05-25 10:34:08 +03:00
Andreas Rheinhardt
45765b7c2e avformat/flacdec: Reorder allocations to avoid leak on error
Fixes Coverity issue #1591795.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit b50c5d02900363c17560cf79e2af0ca3073ee81a)
2024-05-25 01:46:13 +02:00
Andreas Rheinhardt
2bfcc11f51 avcodec/adts_parser: Don't presume buffer to be padded
The documentation of av_adts_header_parse() does not require
the buffer to be padded at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 6c812a80ddfadb3e69018971a2e92ace5326db36)
2024-05-25 01:45:33 +02:00
Andreas Rheinhardt
a08da68e0a avformat/movenc: Check av_malloc()
Fixes Coverity issue #1596735.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 601873263e618e2dc2b615ae95e605575171ee30)
2024-05-25 01:44:01 +02:00
Andreas Rheinhardt
7050b247b2 avcodec/vp8: Return error on error
Regression since e1ba00ac8f755f37ebc8448d3dbea906d7b79da2.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 67c7c44c7956c4ecde0d36652f3d34bca13bffdb)
2024-05-25 01:43:05 +02:00
James Almer
17674b150f avformat/mov: store sample_sizes as unsigned ints
As defined in Section 8.7.3.2.1 of ISO 14496-12.
Any unsupported value will be rejected in mov_build_index() without outright
aborting demuxing.

Fixes ticket #11005.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 3146b77a7d314f55b8ec5d8ce6fda2c5db049a27)
2024-05-24 20:10:11 -03:00
James Almer
85d4df3873 avformat/vvc: fix parsing sps_subpic_id
The length of the sps_subpic_id[i] syntax element is sps_subpic_id_len_minus1 + 1 bits.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 2d84ee374528a8a8eed345a8147e146a0112e43a)
2024-05-22 17:52:30 -03:00
James Almer
1a6995c6d6 avformat/vvc: initialize some ptl flags
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 3bd7e3a336822c75865930f7fafb36d1a1c4c3c3)
2024-05-22 17:52:27 -03:00
Michael Niedermayer
a49a8dc0d6
avcodec/mscc & mwsc: Check loop counts before use
This could cause timeouts

Fixes: CID1439568 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e35fe3d8b9e345527a05b1ae958ac851fe09f1ed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-22 22:04:44 +02:00
Michael Niedermayer
435b74c6a5
avcodec/mpegvideo_enc: Fix potential overflow in RD
Fixes: CID1500285 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b6b2b01025e016ce29e5add57305384a663edcfc)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-22 22:04:43 +02:00