Commit graph

118357 commits

Author SHA1 Message Date
James Almer
fd1772b747 avformat/mov: fix potential unsigned underflow in loop condition
if sc->tts_count is 0, this condition will wrap around to UINT_MAX and the
code will try to dereference a NULL pointer.

Fixes ticket #11417

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-13 19:27:00 -03:00
Nuo Mi
8eb1d76e14 lavc/vvc/refs: export keyframe and picture type in output frames
fixes https://trac.ffmpeg.org/ticket/11406

Co-authored-by: Ruben Gonzalez <rgonzalez@fluendo.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-13 18:05:06 -03:00
James Almer
d5873be583 avformat/iamf_parse: add missing av_free() call on failure path
Fixes ticket #11416

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-13 17:28:22 -03:00
Jun Zhao
b88fc4e098 lavc/ac3dsp: fix R-V HAVE_RVV scope issue
fix R-V HAVE_RVV scope issue

Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2025-01-13 23:58:54 +08:00
Jun Zhao
8ded602eda ffbuild/bin2c: misc fix
close input file if open output fail/read errors.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2025-01-13 23:58:36 +08:00
851a84650e
hwcontext_vulkan: check if semaphores are exportable before enabling exporting
lavapipe recently added support for external_semaphore_fd, but only for syncfiles,
not for opaque file descriptors.

The code is written to allow using syncfiles later on.

Ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12422
2025-01-13 10:44:30 +09:00
Andreas Rheinhardt
5a72266d49 tests/checkasm/sw_rgb: Fix leaks
Also use loop-scope for variables where appropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
e540381f91 avfilter/vf_xpsnr: Avoid array only one of whose elements is used
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
7822beed85 avfilter/vf_xpsnr: Fix leaks
This filter uses the AVBuffer API to allocate buffers that are never
shared at all and frees them via av_freep() (actually, it passes
pointers to AVBufferRefs to av_freep, so that only the AVBuffer
structures are freed at all (because AVBufferRef has a AVBuffer* as its
first member), not the AVBufferRef and not the underlying buffers;
and due to a wrong check the AVBuffers corresponding
to buf_org[c] with c>0 were never freed at all). This is a violation
of the AVBuffer API and causes a memleak. Fix this by avoiding the
AVBuffer API altogether.
(The FATE tests don't catch this, because they use piping to awk,
so that the error code from ffmpeg is ignored.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
7ab7d9c3c0 avfilter/avfilter: Add FFFilter, hide internals of AVFilter
This patch is analogous to 20f9727018:
It hides the internal part of AVFilter by adding a new internal
structure FFFilter (declared in filters.h) that has an AVFilter
as its first member; the internal part of AVFilter is moved to
this new structure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
9bbab3255b avfilter/vf_overlay: Remove spec-incompliant ';'
Fixes warnings with -pedantic with GCC and Clang.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:40 +01:00
Andreas Rheinhardt
4cf445c75d tests/ref/fate/png-icc-parse: Add lossless flag to ref file
Forgotten in 8a29b4e38d
(this test depends on lcms2 and is therefore disabled by default).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
4973bb661e swscale/cms,graph,lut3d: Use ff_-prefix, don't export internal functions
Symbols with the sws_* prefix are exported.

Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
0bc1d2fac4 avcodec/aac/aacdec: Fix -Wdeclaration-after-statement
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
b239eefeb5 avcodec/sga: Silence -Wunused-but-set-variable warnings
The variables are used, but only inside an av_assert1().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
Andreas Rheinhardt
7a5d6690fc avcodec/aac_ac3_parser: Remove unused variable
Added in 64bb91fd3b, never used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-01-12 15:41:39 +01:00
James Almer
5f6e43f77d tests/fate/lavf-container: fix dependencies for lavf_container_fate tests
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-12 11:13:35 -03:00
James Almer
df50370e1b avformat/matroska: add support for VVC streams
As defined in https://github.com/ietf-wg-cellar/matroska-specification/blob/master/codec_specs.md#v_mpegiisovvc

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-12 11:13:31 -03:00
Frank Plowman
8bd66a8c95 lavc/vvc: Check slice structure
The criteria for slice structure validity is similar to that of
subpicture structure validity that we saw not too long ago [1].
The relationship between tiles and slices must satisfy the following
properties:

* Exhaustivity.  All tiles in a picture must belong to a slice.  The
  tiles cover the picture, so this implies the slices must cover the
  picture.
* Mutual exclusivity.  No tile may belong to more than one slice, i.e.
  slices may not overlap.

In most cases these properties are guaranteed by the syntax.  There is
one noticable exception however: when pps_tile_idx_delta_present_flag is
equal to one, each slice is associated with a syntax element
pps_tile_idx_delta_val[i] which "specifies the difference between the
tile index of the tile containing the first CTU in the ( i + 1 )-th
rectangular slice and the tile index of the tile containing the first
CTU in the i-th rectangular slice" [2].  When these syntax elements are
present, the i-th slice can begin anywhere and the usual guarantees
provided by the syntax are lost.

The patch detects slice structures which violate either of the two
properties above, and are therefore invalid, while building the
slice map.  Should the slice map be determined to be invalid, an
AVERROR_INVALIDDATA is returned.  This prevents issues including
segmentation faults when trying to decode,  invalid bitstreams.

[1]: https://ffmpeg.org//pipermail/ffmpeg-devel/2024-October/334470.html
[2]: H.266 (V3) Section 7.4.3.5, Picture parameter set RBSP semantics

Signed-off-by: Frank Plowman <post@frankplowman.com>
2025-01-12 13:15:06 +08:00
Peter Ross
2202dcfc0f avformat/iff: ignore FVER tag when not processing DSD/DST files
Fixes ticket #10030.
2025-01-12 11:14:16 +11:00
Peter Ross
ba22d6a24f avformat/wtvenc: do not output negative 'third timestamp' field
Fixes ticket #3659.
2025-01-12 11:07:57 +11:00
Peter Ross
330470ef24 avformat/mlvdec: skip over some other known block types 2025-01-12 10:55:47 +11:00
Peter Ross
45c30bc51e avformat/mlvdec: process VERS block 2025-01-12 10:55:44 +11:00
Peter Ross
86dd15fd0d avformat/mlvdec: demux LJ92 huffman comressed frames
A minimal DNG header is added to each LJ92 compressed frame, allowing
thme to be decoded by the TIFF decoder. The TIFF decoder is responsible
for setting up the MJPEG decoder, signalling the correct s->bayer flag,
and setting pix_fmt.

The LJ92 compressed frames can be muxed out to DNG files, and manipulated
in DNG software. Tested with darktable and rawtherapee.

Contributor: South East <8billion.people@gmail.com>
2025-01-12 10:55:39 +11:00
f651ca3a68
avutil/frame.h: improve documentation for AV_FRAME_FLAG_LOSSLESS
It should be more clear what this flag is indicating with a more
verbose comment documenting it.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Alexander Strasser <eclipse7@gmx.net>
Reviewed-by: Marth64 <marth64@proxyid.net>
2025-01-11 10:31:00 -05:00
b76053d8bf avformat/flvdec: add support for legacy HEVC files 2025-01-10 21:55:23 +01:00
James Almer
5cd49e1bfd avcodec/hevc/hevcdec: use av_frame_side_data_add() where useful
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 15:02:31 -03:00
James Almer
f635f19537 avcodec/aom_film_grain: use av_frame_side_data_add() where useful
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 15:02:31 -03:00
James Almer
42e72d5c8b avutil/frame: add AV_FRAME_SIDE_DATA_FLAG_NEW_REF
The flag is documented but did not exist. So introduce it as it can be
useful.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 15:02:22 -03:00
James Almer
7f9c7f9849 avcodec/jpeg2000dec: clear array length when freeing it
Fixes NULL pointer dereferences.
Fixes ticket #11393.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 14:56:03 -03:00
James Almer
292c1df7c1 avformat/mov: merge stts and ctts arrays into one
Should reduce memory usage as well as remove code duplication.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-01-10 10:39:00 -03:00
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