1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00
Commit Graph

114804 Commits

Author SHA1 Message Date
Michael Niedermayer
1e23d86cd5
tools/decode_simple: Check avcodec_send_packet() for errors on flushing
This will not error but the API allows errors so we should check it
Fixes: CID1489999 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6df8bd64ff)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:59 +02:00
Michael Niedermayer
eb1e40909b
swscale/yuv2rgb: Use 64bit for brightness computation
This will not overflow for normal values
Fixes: CID1500280 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bfc22f364d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:58 +02:00
Michael Niedermayer
98a1c887c3
swscale/x86/swscale: use a clearer name for INPUT_PLANER_RGB_A_FUNC_CASE
related: CID1497114 Missing break in switch

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3f9daf1c18)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:58 +02:00
Michael Niedermayer
31afbc0e4c
avutil/tests/opt: Check av_set_options_string() for failure
This is test code after all so it should test things

Fixes: CID1518990 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e3481730ed)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-25 20:33:58 +02:00
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 e8a1e1899d)
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 c4004605b2)
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 33da5f4e27)
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 e7775973f0)
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 b6fa2ed77e)
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 2aab4e4cc0)
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 9ce065c90d)
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 7dabad079b)
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 54b8d5e201)
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 2094f40295)
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 709a5687ed)
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 180c869faf)
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 b248dace92)
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 0ae157b360)
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 7fab9b9761)
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 c69e6cccd7)
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 c21fb3624b)
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 84b454935f.

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 0d5e3f5a40)
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 7894904141.

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 c7a57b0f70.

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 c9151ea507)
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 41190da9e1)
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 6d4eba51f2)
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 c841cb45e8)
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 45d31614bc)
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 af20fb9c4e)
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 43b1a95678)
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 e6b38c944f)
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>
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 f883746587)
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 b50c5d0290)
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 6c812a80dd)
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 601873263e)
2024-05-25 01:44:01 +02:00
Andreas Rheinhardt
7050b247b2 avcodec/vp8: Return error on error
Regression since e1ba00ac8f.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 67c7c44c79)
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 3146b77a7d)
2024-05-24 20:10:11 -03:00