Commit graph

118376 commits

Author SHA1 Message Date
James Almer
d7180a3f92 avcodec/vvc/dec: print thread debug logs only if DEBUG is defined
Makes the output of a normal decoding process with loglevel debug a lot less
verbose.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 10:23:57 -03:00
Jonathan Baudanza
c0fbb6d5b7 avformat/rtpdec: int overflow in start_time_realtime
This was previously adjusted by me in 6b3f9c2e92.
Unfortunately, I traded one integer overflow bug for
another.

Currently, NTP timestamps that exceed INT64_MAX
(~Jan 20, 1968) will cause an overflow when passed
to av_rescale.

This patch replaces av_rescale, which operates on
int64_t, with ff_parse_ntp_time, which operates on
uint64_t. This will give the correct values for
timestamps back around the NTP epoch and present day
timestamps.

Fixes ticket #11388.

Signed-off-by: Martin Storsjö <martin@martin.st>
2025-01-10 12:09:27 +02:00
251de1791e
avcodec/vc1dec: Clear block_index in vc1_decode_reset()
Fixes: 377965565/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-4504434689769472
Fixes: out of array access

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:27 +01:00
3f029bfb7f
avcodec/aacsbr_template: Clear n_q on error
Fixes: index 5 out of bounds for type 'uint8_t [5]'
Fixes: 377748135/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-5167109774049280

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:27 +01:00
695b7c71d9
tools/target_dec_fuzzer: Adjust threshold for MSCC
Fixes: Timeout
Fixes: 377574369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSCC_fuzzer-4924697608781824

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:26 +01:00
4485a0fd77
avformat/iamf_parse: Check output_channel_count
Fixes: -nan is outside the range of representable values of type 'int'
Fixes: 377072730/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-6545416570601472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:26 +01:00
70514ff0ec
tools/target_dec_fuzzer: Adjust threshold for VP6
Fixes: Timeout (would need 62sec)
Fixes: 376731123/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP6_fuzzer-5926437896388608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:26 +01:00
f7cc023f06
avformat/mxfdec: Check edit_unit for being larger than signed 64bit
Fixes: signed integer overflow: 2 * -4962931467012268000 cannot be represented in type 'long'
Fixes: 376496313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4921469185884160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:25 +01:00
4bd9b5f520
tools/target_dec_fuzzer: Adjust threshold for TDSC
Fixes: Timeout
Fixes: 376320337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TDSC_fuzzer-6259585758855168

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:25 +01:00
0f511b4518
avcodec/osq: Fixes several undefined overflows in do_decode()
Fixes: signed integer overflow: 1239596184 + 2119376059 cannot be represented in type 'int'
Fixes: 376136844/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6581164455821312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:25 +01:00
56faee21c1
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
Fixes: signed integer overflow: -1082982400 + -1195645138 cannot be represented in type 'int'
Fixes: 376136843/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4791844321427456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:24 +01:00
b5b6391d64
avfilter/af_pan: Fix sscanf() use
Fixes: Memory Data Leak

Found-by: Simcha Kosman <simcha.kosman@cyberark.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:24 +01:00
9ffa127aa6
avfilter/vf_grayworld: Use the correct pointer for av_log()
Fixes: crash

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:24 +01:00
b72de49295
avfilter/vf_addroi: Add missing NULL termination to addroi_var_names[]()
Fixes: out of array read

Found-by: Elias Myllymäki <elias.myllymaki04p@gmail.com>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-01-08 23:23:23 +01:00
Frank Plowman
cb60b29ac5 fate/vvc: Add vvc-frames-with-ltr.vvc
This sample is rather difficult, containing a lot of subtle edge cases
which revealed errors in the VVC decoder.  It covers 88.4% of lines in
libavcodec/vvc and brings the line coverage of the entire VVC fate suite
from 96.3% to 97.2%.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-08 10:10:06 -03:00
910e5a275d avformat/avformat.h: elaborate documentation for avformat_open_input() on error condition
Signed-off-by: Marth64 <marth64@proxyid.net>
2025-01-08 00:14:13 -06:00
Scott Theisen
8ad2d1919f libavcodec/mpeg12dec: append CC data to a53_buf_ref
In mpeg_decode_a53_cc() only the A/53 part 4 CC data ("GA94") is saved between
frames. The other formats incorrectly created a larger buffer than they use
since a705bcd763 because they did not append to
the previous data.

The a53_buf_ref is added to the frame in mpeg_field_start() which will only be
called in decode_chunks() if not all of the picture data slices are skipped.

For these formats, utilize the data added to the buffer in case frames are skipped
(concatenating the CC data until a frame can be exported), in a similar fashion to
the A/53 part 4 logic.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Marth64 <marth64@proxyid.net>
2025-01-08 00:03:47 -06:00
9305a1edca avcodec/mpeg12dec: fix range for cc_format option
After support was added for DVB 0502 Closed Caption coding,
the cc_format option's range was never updated so user
cannot select this coding as a forced formatting choice.

Fix the range of the option by ending it with the new coding type.

Signed-off-by: Marth64 <marth64@proxyid.net>
2025-01-07 23:54:35 -06:00
NyanMaths
1215fefcb8
avformat/ipfsgateway: fix capitalizaton mistake
Fix the incorrect capitalization of the project name in a comment.
The project is named FFmpeg, not FFMpeg.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-01-07 17:47:15 -05:00
James Almer
692ce2503e avformat/flvdec: initialize ret in flv_read_packet() to AVERROR_BUG
This will ensure any future goto leave that may be added doesn't accidentally forget to
set ret to some proper value.

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-07 16:09:49 -03:00
af74fe7139 avformat/flvdec: don't leak extradata pointer on realloc failure 2025-01-07 19:20:30 +01:00
9201f872b1 avformat/flvdec: properly free mt_extradata 2025-01-07 19:07:43 +01:00
Alessandro Ros
9fe66c7fcb avformat/flvenc: fix missing sequence start with MP3 tracks
When muxing to FLV/RTMP a MP3 track with an ID greater than zero,
enhanced RTMP has to be used, and a sequence start should preceed track
data.

This is already implemented (see line 823 of flvenc.c) but the code is
never reached due to a too-strict condition before it. This patch fixes
the issue.

Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2025-01-07 18:38:11 +01:00
b32a1a69a4 avformat/flvenc: properly handle writing mpeg4 extradata 2025-01-07 18:30:23 +01:00
4c2b769e53 avformat/flvdec: clean up variable initialization spacing 2025-01-07 18:18:38 +01:00
0ed3446738 avformat/flvdec: fix potential premature return on audio MultichannelConfig 2025-01-07 18:18:02 +01:00
e9de794d7f avformat/flvdec: add missing track_size decrement 2025-01-07 17:57:52 +01:00
Koushik Dutta
252fc2e047 avfilter/scale_vulkan: add dynamic crop region and aspect ratio match
The scale_vulkan filter initializes the shader once, with the crop
region set by the original frame. However, subsequent frames may
specify a different crop region than the first frame. This change
updates the cropping to match the behavior present on the other
hardware frame scale filters.

The scale filter should also allow negative values
that respect aspect ratio, similar to other scale filters.

Signed-off-by: Koushik Dutta <koushd@gmail.com>
2025-01-07 08:34:59 +09:00
Marton Balint
19c95ecbff avcodec: deprecate AVCodecContext properties
These properties are unreliable because they depend on the frames decoded so
far, users should check directly the presence of the decoded AVFrame side data
or AVFrame flags.

Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-05 22:25:29 +01:00
Marton Balint
8a29b4e38d fftools/ffprobe: print lossless frame flag
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-05 22:23:16 +01:00
Marton Balint
74e04b8921 avcodec: set AV_FRAME_FLAG_LOSSLESS where supported
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-05 22:23:16 +01:00
Marton Balint
2d91f89445 avcodec/frame: add AV_FRAME_FLAG_LOSSLESS
Signed-off-by: Marton Balint <cus@passwd.hu>
2025-01-05 22:23:15 +01:00
Frank Plowman
539cea3183 lavc/vvc: Fix race condition for MVs cropped to subpic
When the current subpicture has sps_subpic_treated_as_pic_flag equal to
1, motion vectors are cropped such that they cannot point to other
subpictures.  This was accounted for in the prediction logic, but not
in pred_get_y, which is used by the scheduling logic to determine which
parts of the reference pictures must have been reconstructed before
inter prediction of a subsequent frame may begin.  Consequently, where a
motion vector pointed to a location significantly above the current
subpicture, there was the possibility of a race condition.  Patch fixes
this by cropping the motion vector to the current subpicture in
pred_get_y.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-01-05 20:25:29 +08:00
Chris Warrington
f80af3657f avcodec/vvc decode: ALF filtering without CC-ALF
When a stream has ALF filtering enabled but not CC-ALF, the CC-ALF set indexes alf->ctb_cc_idc are being read uninitialized during ALF filtering.

This change initializes alf->ctb_cc_idc whenever ALF is enabled.

Ref. https://trac.ffmpeg.org/ticket/11325
2025-01-05 18:00:18 +08:00
James Almer
2919767750 Revert "avformat/dump: print only the actual streams in a tile grid group"
Indexes in tile_grid->offsets were fixed in the previous commit, but just in case,
make sure to not overread the streams array.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-05 00:32:07 -03:00
James Almer
bf0786d9bd avformat/mov: fix setting tile grid stream offsets when a stream is referenced more than once
The amount of tiles does not necessarely need to match the amount of streams referenced
in the grid, as there could be duplicates.
Don't silently ignore EEXIST return codes from avformat_stream_group_add_stream() and
instead store the index of the duplicate stream.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-05 00:31:58 -03:00
James Almer
cd174c7c7c avfilter/aeval: don't leak the strdup'd expression string
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-04 20:45:10 -03:00
James Almer
e262411f32 avfilter/aeval: tighten the check for empty expression
Fixes ticket #11395

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-04 20:45:10 -03:00
Leandro Santiago
9d9ac8e2ca avfilter/vf_dnn_detect: fix loading anchors when labels file is set
References https://trac.ffmpeg.org/ticket/11387

Defining anchors is needed, even when a filename with the labels is set.
The issue was identified when using yolov4-tiny model using openvino.

More information about how to reproduce the bug can be found on the trac
issue referenced by this commit.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
2025-01-04 20:12:12 +08:00
07e54f9b5c
avformat/jpegxl_anim_dec: use new animated JPEG XL codec ID
A new codec ID has been added to avcodec for animated JPEG XL, so
we should use that in the animated JPEG XL demuxer.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-01-03 19:37:36 -05:00
f3c4082645
avcodec/libjxl: add animated JPEG XL encoder
libjxl supports animated encoding, so we add a wrapper to the
library using the receive_packet callback method.

This code was based largely on a patch sent by Zsolt Vadász,
although it was updated to use more recent coding practices
and many of the leaks and issues were fixed.

Reviewed-by: Marth64 <marth64@proxyid.net>
Co-authored-by: Zsolt Vadász <zsolt_vadasz@protonmail.com>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2025-01-03 19:37:28 -05:00
Janne Grunau
060464105b vp9: recon: Use emulated edge to prevent buffer overflows
The arm/aarch64 horizontal filter reads one additional pixel beyond what
the filter uses. This can become an issue if the application does not
allocate larger buffers than what's required for the pixel data. If the
motion vector points to the bottom right edge of the picture this
becomes a read buffer overflow. This triggers segfaults in Firefox for
video resolutions which result in a page aligned picture size like
1280x640.
Prevent this by using emulated edge in this case.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1881185
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2025-01-03 17:53:49 -05:00
Janne Grunau
f366256215 arm: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
This reduces the amount the horizontal filters read beyond the filter
width to a consistent 1 pixel. The data is not used so this is usually
not noticeable. It becomes a problem when the application allocates
frame buffers only for the aligned picture size and the end of it is at
a page boundary. This happens for picture sizes which are a multiple of
the page size like 1280x640. The frame buffer allocation is based on
its most likely done via mmap + MAP_ANONYMOUS so start and end of the
buffer are page aligned and the previous and next page are not
necessarily mapped.
This mirrors the aarch64 change.

Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2025-01-03 17:53:48 -05:00
Janne Grunau
430c38f698 aarch64: vp9mc: Load only 12 pixels in the 4 pixel wide horizontal filter
This reduces the amount the horizontal filters read beyond the filter
width to a consistent 1 pixel. The data is not used so this is usually
not noticeable. It becomes a problem when the application allocates
frame buffers only for the aligned picture size and the end of it is at
a page boundary. This happens for picture sizes which are a multiple of
the page size like 1280x640. The frame buffer allocation is based on
its most likely done via mmap + MAP_ANONYMOUS so start and end of the
buffer are page aligned and the previous and next page are not
necessarily mapped.
Under these conditions like seen by Firefox a read beyond the end of the
buffer results in a segfault.
After the over-read is reduced to a single pixel it's reasonable to use
VP9's emulated edge motion compensation for this.

Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1881185
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2025-01-03 17:53:46 -05:00
James Almer
2f4ec16836 avcodec/opus/parser: remove duplicate failure path code
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-03 18:23:07 -03:00
James Almer
37155d68ec avcodec/opus/parser: set duration when complete frames are fed
Fixes a regression since 873a34c129.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-03 18:22:02 -03:00
James Almer
4bf784c0e5 avformat/dump: print only the actual streams in a tile grid group
The amount of tiles does not necessarely need to match the amount of streams.

Fixes ticket #11389.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-03 10:34:03 -03:00
James Almer
c187dd88de avcodec/opus/parser: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-03 10:34:01 -03:00
James Almer
873a34c129 avcodec/opus/parser: set sample rate
Ensures it's set on scenarios where a parser is requested but no decoder is
present.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-03 10:33:31 -03:00
James Almer
fb59995b88 avformat/flvdec: set Opus sample rate
Fixes parsing Opus streams when no opus decoder is present.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-03 10:31:20 -03:00