1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

108470 Commits

Author SHA1 Message Date
Vincent Herbst
b5d146d17c avfilter/vf_yadif_videotoolbox: fix over-release of autoreleased Metal objects
call_kernel() obtains the command buffer and compute encoder from
property getters (mtlQueue.commandBuffer, buffer.computeCommandEncoder),
which return autoreleased references under the non-ARC build, and then
releases them via ff_objc_release(). That is an over-release: when the
enclosing autorelease pool is drained, the objects are released a second
time and the process crashes with EXC_BAD_ACCESS in objc_release.

On current macOS this is reproducible with the ffmpeg CLI itself. The
filter thread's thread-local autorelease pool is popped during pthread
TSD cleanup at thread exit, so any run that used yadif_videotoolbox
crashes when the filter thread terminates:

  ffmpeg -init_hw_device videotoolbox=vt -filter_hw_device vt \
    -f lavfi -i testsrc2=size=640x480:rate=30 \
    -vf setfield=tff,format=nv12,hwupload,yadif_videotoolbox,\
  hwdownload,format=nv12 -frames:v 20 -f null -

  Thread 11 Crashed:: vf#0:0
  0 libobjc.A.dylib  objc_release + 16
  1 libobjc.A.dylib  AutoreleasePoolPage::releaseUntil(objc_object**) + 204
  2 libobjc.A.dylib  objc_autoreleasePoolPop + 244
  3 libobjc.A.dylib  objc_tls_direct_base<...>::dtor_(void*) + 156
  4 libsystem_pthread.dylib  _pthread_tsd_cleanup + 620
  5 libsystem_pthread.dylib  _pthread_exit + 84

Host applications hit the same crash earlier, for example when a
dispatch queue drains its last-resort pool after a work item that ran
the filter.

Wrap the kernel invocation in @autoreleasepool and drop the manual
releases, making the pool pop the single balanced release and draining
the Metal transients once per frame. The ff_objc_release() calls on the
s->mtl* members in do_uninit() stay: those hold owned references
obtained from new* methods.

(cherry picked from commit 7f2e5cdd7c)
2026-10-20 02:00:08 +00:00
Brad Smith
f1000559d1 avcodec/mips/cabac: Fix building on OpenBSD/mips64
src/libavcodec/mips/cabac.h:160:77: error: instruction requires a CPU feature not currently enabled
  160 |         PTR_SUBU   "%[tmp1],         %[c_low],        %[tmp1]             \n\t"
      |                                                                             ^
<inline asm>:13:2: note: instantiated into assembly here
   13 |         movz       $15,          $13,          $24
      |         ^

OpenBSD targets MIPS III ISA.

(cherry picked from commit 9432f85830)

Assisted-by: Fairy
2026-10-10 19:14:36 +00:00
Timo Rothenpieler
8572ebd8a8 avformat/imfdec: don't busy-loop if non-Asset in Asset-list
(cherry picked from commit ef305e32e8)
2026-10-09 23:24:18 +00:00
Timo Rothenpieler
4236007b60 avfilter/vf_convolution: don't assume frame is multiple of 16 pixels wide
Limit the 8-bit column filter to the pixels remaining in the current slice. Pass slice_end - y at all three call sites so both the 8-bit and high-bit-depth column filters receive the correct remaining width. This handles partial 16-pixel blocks at frame and thread-slice boundaries. The non-column callbacks do not use this argument.

Fixes: #YWH-PGM40646-36
(cherry picked from commit 8b9e02cc17)
2026-09-29 19:50:49 +00:00
Timo Rothenpieler
85b823bb6b avformat/mux: don't let positive write_trailer ret shadow pb failure
(cherry picked from commit 1de217ad4b)
2026-09-29 19:25:12 +00:00
Sergei Iashin
41e8a13c12 libavformat/dashenc.c: check if packets were muxed before calculating average bitrate
Prevents SIGFPE.
Fixes issue #24738.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d62aef2e50)
2026-09-27 11:52:32 -03:00
Timo Rothenpieler
b8ca709bf9 avformat/mov: don't leak on realloc failure
Fixes: #YWH-PGM40646-48
(cherry picked from commit d975849594)
2026-09-26 16:04:08 +00:00
James Almer
637cf2c66c avcodec/libfdk-aacdec: clear and reset some fields when flushing
The decoder can't know where a seek landed, so the "delay_samples" way to
discard the decoder delay in the first frame is not truly viable, so it needs
to be removed.
Add a call to aacDecoder_DecodeFrame() with the AACDEC_CLRHIST flag set, as the
call to aacDecoder_SetParam() with the AAC_TPDEC_CLEAR_BUFFER setting was
seemingly not enough to truly flush all the fdkaac internal buffers.

Should fix issue #24527.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b894a6f7c1)
2026-09-19 21:42:42 -03:00
James Almer
3fa86e1fdb avcodec/libfdk-aacdec: properly handle decoder delay
Shift timestamps when available, and take into account the caller requested
samples to be discarded alongside the decoder delay.

Should fix issue #24526.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c8595be8e6)
2026-09-19 21:42:42 -03:00
James Almer
038218fbac avcodec/libfdk-aacdec: fix the check for downmix layout order
The code reads a mask afer this check, meaning it expects NATIVE order, not
others.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7755d264bd)
2026-09-19 21:42:42 -03:00
James Almer
26ce40b7dc avcodec/libfdk-aacdec: set keyframe flag and profile in output frames
Don't depend on the generic code setting this.
This is in preparation for a following change.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 281b7fc02e)
2026-09-19 21:42:38 -03:00
Sean McGovern
d34d680b0e libavcodec/dca_core_bsf: add a missing include to ensure FF_PROFILE_UNKNOWN is defined 2026-09-18 08:57:59 -04:00
James Almer
ef19491b82 avcodec/bsf/dca_core: clear profile value on init()
The output stream no longer has extension sub-streams, so the
declared input profile, if it was set, is no longer valid.

Fixes issue #24388.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7dc71230a9)
2026-09-06 20:42:20 -03:00
Kacper Michajłow
7499ccc61a avcodec/h264_direct: do not read the other field's rows of colocated mb_type
To determine whether the colocated picture is field coded, the temporal
and spatial direct setup peek at
sl->ref_list[1][0].parent->mb_type[mb_xy] before mb_xy has been remapped
to the colocated field's parity. That row belongs to the current field's
parity, while await_reference_mb_row() above waited on the parity of the
referenced field, so whenever the two differ the load is unsynchronised
and with frame threading can observe macroblocks of a field that is
still being decoded.

Every macroblock of a field picture has MB_TYPE_INTERLACED set, so
checking field_picture first gives the same result in all correctly
synchronized cases without touching the mb_type array.

This also fixes few TSAN reported warnings.

Fixes: https://trac.ffmpeg.org/ticket/10891
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit c3a8a223b29260dc170d41c62f9b3b33f6b97b2d)
2026-08-26 00:42:36 +00:00
Kacper Michajłow
9748b8900b avcodec/h264_slice: clear the ER picture when starting a second field
h264_frame_start() clears h->er.cur_pic, and decode_nal_units() only sets
it again for pictures that are not field coded, right before running error
concealment. A second field goes through neither, so h->er.cur_pic keeps
pointing at whatever frame coded picture the context decoded earlier.

With frame threading the two fields of a pair are decoded by different
contexts, so whether this triggers depends on what the context that picks
up the second field decoded before, which is why the number of bogus
warnings varies between runs.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit f1d318e5eb2eb487d2be4b4b721b93ae76fd5ba7)
2026-08-26 00:42:35 +00:00
Kacper Michajłow
c5279ae2f6 avcodec/h264_direct: await both fields of a colocated field pair
When a frame coded picture uses a complementary field pair as its
colocated picture, ff_h264_direct_ref_list_init() selects the field whose
POC is closest to the current one and stores it in col_parity. The direct
mode setup then remaps mb_xy to that parity and reads the colocated
mb_type, motion_val and ref_index from it.

await_reference_mb_row() waits on the field given by "ref_field_picture &&
ref_field", which is 1 for any such reference, since the pair is
referenced as a frame and ref->reference is 3. Only the bottom field is
therefore awaited, while the data is just as likely to be read from the
top one. With frame threading the two fields are decoded by different
threads, so the colocated data can be read while the field it belongs to
is still being decoded, yielding stale motion vectors and a corrupt
frame. await_references() already handles the same case correctly for
motion compensation.

Fixes sporadic failures of fate-h264-conformance-cabac_mot_picaff0_full,
where display frame 14.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 274cb6731bd204e9537a7e588d4a3436fdf51b93)
2026-08-14 12:40:37 +00:00
Kacper Michajłow
42b915e10a avcodec/h264_direct: move check before loading things
(cherry picked from commit 029c80900e2b92a8495e36aa19d7fac9c55b8482)
2026-08-14 12:40:37 +00:00
James Almer
edd4d6d8e6 avcodec/get_buffer: use frame pixel format instead of context
The documentation for get_buffer2() states:

"This callback must use the frame values, not the codec context values, to
calculate the required buffer size."

Fixes wrong output on hbd LCEVC enhanced samples where the base stream is
8bit.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit e1c1b6c558)
2026-07-23 14:12:58 +00:00
Patrice Dumas
6de5cea239 doc/t2h: Support texinfo 7.1 and 7.2 pretest
Here is a proposed patch for portability of doc/t2h.pm for GNU Texinfo
7.1 and 7.1.90 (7.2 pretest).  I tested against 7.1 and 7.1.90 (7.2
pretest).  There is a difference in the headings compared to the website
version, maybe related to FA_ICONS not being set the same, but the
result seems correct.

I also renamed $element to $output_unit in ffmpeg_heading_command as in
new equivalent makeinfo/texi2any code the $element variable is the
$command variable in ffmpeg_heading_command, which is very confusing.  I
left as is the $command variable to have a patch easier to read, but it
could make sense to rename $command as $element later on.

The patch could also have effects with Texinfo 7.0, since some of the
changes are for that version, but that probably never show up because it
is for situations that may not exist in ffmpeg manuals (for example
@node without sectioning command), or because the code is robust to some
missing information (case of $heading_level in ffmpeg_heading_command
that was not set, as far as I can tell).

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 4d9cdf82ee)
2026-06-21 21:22:47 +02:00
Michael Niedermayer
19feb712f5 avfilter: use ff_slice_pos() for per-slice boundary computation
This is a behavior preserving change for all non-overflowing cases.

Slice-based filters computed per-slice boundaries as (dim * jobnr) / nb_jobs
in int, which overflows for large dimensions with many slice threads,
yielding wrong slice bounds and out-of-array accesses. ff_slice_pos()
performs the multiplication in 64bit.

Backported to 5.1: applied the ff_slice_pos() conversion to the filters
present in 5.1 (filters added after the 5.1 branch are skipped), and added
the required filters.h includes. ff_slice_pos() itself is already present
in 5.1. Channel-count based slices (bounded, cannot overflow) are left as
in 6.1.

(cherry picked from commit f7368f97b9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
n5.1.10
2026-06-21 12:05:56 +02:00
Michael Niedermayer
30ca8fd389 Update for 5.1.10
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 03:31:23 +02:00
Marvin Scholz
3a66f856c6 configure: do not use interval regexp operators with awk
Some awk implementations like mawk (used on Ubuntu) do not support
these.

(cherry picked from commit 4858a8ee2f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Marvin Scholz
84533806e7 configure: fix symbol prefix detection
The symbol prefix check would incorrectly detect a bogus prefix in
circumstances where sanitizers instrument the build, like when
configuring with the clang-asan toolchain where it would detect the
prefix as __odr_asan_gen_, which is obviously wrong.

To fix this, adjust the prefix detection to only detect a
one-character prefix, which is the only case that matters
anywhere right now.

(cherry picked from commit 910bf33879)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Andreas Rheinhardt
725f46e472 configure: Disable linker warnings for common symbols
Common symbols are not part of ISO-C and therefore not used
by FFmpeg at all. Yet linker warnings to ensure it stays
that way are nevertheless wrong, because the existence of
common symbols does not imply that there is a bug in our code.

More precisely, Clang's ASAN implementation uses a common symbol
___asan_globals_registered when used on Elf targets with
the -fsanitize-address-globals-dead-stripping option;
said option is the default since Clang 17 [1].
This leads to 1883 warnings about ___asan_globals_registered
when linking here.
(Even without that option there were warnings like
_ZN14__interception10real_vforkE being overridden.)

Said warning is also unnecessary: The proper way to ensure
that our code is free of common symbols is to let the compiler
enforce this. But this is already the default since GCC 10
and Clang 11, so there is no risk of introducing our own
common symbols.

[1]: https://reviews.llvm.org/D152604

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 25e0e087c4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
badc6d4d0b avcodec/mpegvideo_dec: Add NULL pointer checks to MPV_motion_lowres()
Backported to 5.1's MPV_motion_lowres() in mpegvideo.c.

(cherry picked from commit adfe003f51... adapted to 5.1 mpegvideo.c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
527bc977f1 avcodec/mpegvideo_dec: Fix lowres=3 field select interlaced mpeg4 frame
Fixes: out of array read in the chroma plane
Backported to 5.1's mpeg_motion_lowres() in mpegvideo.c.

(cherry picked from commit e8a2d5fca3... adapted to 5.1 mpegvideo.c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
ee60e57778 avcodec/mpegvideo_dec: consider interlaced lowres 4:2:0 chroma in edge emulation check better
Backported to 5.1's mpeg_motion_lowres() in mpegvideo.c.

(cherry picked from commit d7d3f1af2a... adapted to 5.1 mpegvideo.c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
78cf72fd2b avcodec/mlpdec: add max channels check
Fixes: out of array access
Fixes: 51648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-4644322217164800

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 f1f78e3cf4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Eli Kobrin
ebdd42dc99 libswresample: Prevent out of bounds.
We've been fuzzing torchvision with [sydr-fuzz](https://github.com/ispras/oss-sydr-fuzz)
and found out of bounds error in ffmpeg project at audioconvert.c:151.
To prevent error we need to fix checks for in and out fmt in swr_init.

Signed-off-by: Eli Kobrin <kobrineli@ispras.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3e97d96e6f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Aidan MacDonald
a0c6ae2831 avcodec/dvdsub_parser: Fix length check for short packets
The DVD subtitle parser handles two types of packets: "normal"
packets with a 16-bit length, and HD-DVD packets that set the
16-bit length to 0 and encode a 32-bit length in the next four
bytes. This implies that HD-DVD packets are at least six bytes
long, but the code didn't actually verify this.

The faulty length check results in an out of bounds read for
zero-length "normal" packets that occur in the input, which are
only 2 bytes long, but get misinterpreted as an HD-DVD packet.
When this happens the parser reads packet_len from beyond the
end of the input buffer. The subtitle stream is not correctly
decoded after this point due to the garbage packet_len.

Fixing this is pretty simple: fix the length check so packets
less than 6 bytes long will not be mistakenly parsed as HD-DVD
packets.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit a4405cc0cc)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
7c03956967 lavfi/bwdif: fix heap-buffer-overflow with small height videos
For frames with height <= 4, filter_intra reads cur[+-3*refs] out of the
plane. Route those rows to filter_edge instead. (The fate ref tests this
commit touches upstream do not exist in 5.1.)

(cherry picked from commit fdfe4d2cfb... adapted to 5.1 vf_bwdif.c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
3575d794b4 avcodec/h264_slice: guard color_frame() against chroma-width underflow
Backported to 5.1's ff_color_frame() in utils.c: for chroma width 1,
bytes-2 underflowed to a huge size in av_memcpy_backptr() -> heap
out-of-bounds write. Guard the writes and use 2*(bytes-1).

(cherry picked from commit b47f49586c... adapted to 5.1 ff_color_frame)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
2c99cc2a2b avformat/matroskadec: Check audio.sub_packet_h * audio.frame_size
Reject block_align larger than the sub_packet_h * frame_size buffer to
avoid a heap out-of-bounds write when deinterleaving RealAudio subpackets.

(cherry picked from commit 20fc83fa5b... adapted to 5.1 structure)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
e07e06a08e avformat/flvdec: Check *size in cts parsing
Fixes: Assertion buf_size >= 0 failed
Fixes: 471553942/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5982849812725760

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 6ee3e59ce2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1b54363cc5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
5180e5c62d avcodec/iff: Clear ham_buf
ham_buf was read uninitialized in some code paths.

(cherry picked from commit 7d62dfda4c... adapted to 5.1 context)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
59b27a6c19 avcodec/h2645_parse: Ignore NAL with nuh_layer_id == 63
Comply with "For purposes other than determining the amount of data in the decoding units
of the bitstream, decoders shall ignore all data that follow the value 63 for nuh_layer_id in a NAL unit"
Rec. ITU-T H.265 v8 (08/2021)	Page 67

Fixes: index 63 out of bounds for type 'const int8_t[63]' (aka 'const signed char[63]')
Fixes: clusterfuzz-testcase-fuzzer_loadfile-5109286752026624
Reported-by: Kacper Michajlow <kasper93@gmail.com>
Found-by: ossfuzz
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 360e7cafd0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d2077aeb8e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
05acb383df avcodec/eatgq: Check bytestream2_get_buffer() for failure
Fixes: Use of uninitialized memory
Fixes: 71546/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGQ_fuzzer-5607656650244096

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 4949e34d96)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 496c9f42b8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
f4edff2fea avcodec/cbs_sei: Always zero-initialize SEI payload
Adapted for 5.1: the non-handler branch used av_buffer_alloc() which does
not zero the payload, so SEI payload fields that are only conditionally
written were read uninitialized. Use av_buffer_allocz() instead.

(cherry picked from commit 67e4f737ed... adapted)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Andreas Rheinhardt
8a58754dfa avformat/mpegts: Don't use uninitialized value in av_log()
It is undefined behaviour in (at least) C11 (see C11 6.3.2.1 (2)).
Fixes Coverity issue #1500314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit 65763bffb6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9fc2ca4511)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:27 +02:00
Michael Niedermayer
5694a15970 avcodec/hevc/hevcdec: Clean sao_pixel_buffer_v on allocation
Fixes: use of uninitialized memory
Fixes: 378102648/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5896308499480576

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 7a21c37f75)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 52d9196ab2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Michael Niedermayer
efabd34a68 avcodec/hevc/hevcdec: initialize qp_y_tab
This does not replicate on my setup, thus this is a blind fix based on ossfuzz trace

Fixes: use of uninitialized value
Fixes: 71747/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5427736120721408

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 4fc43e45f9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9ac8662ac0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Zhao Zhili
842e984ee4 aarch64/hpeldsp_neon: fix out-of-bounds read
Fix #21141

The performance improved a little bit.
On A76:
                              Before            After
put_pixels_tab[0][1]_neon:    32.4 ( 3.91x)     31.6 ( 3.99x)
put_pixels_tab[0][3]_neon:    88.0 ( 4.50x)     74.6 ( 5.31x)
put_pixels_tab[1][1]_neon:    33.5 ( 2.52x)     31.2 ( 2.71x)
put_pixels_tab[1][3]_neon:    30.5 ( 3.61x)     21.7 ( 5.08x)

On A55:
                             Before            After
put_pixels_tab[0][1]_neon:   175.2 ( 2.41x)    138.7 ( 3.04x)
put_pixels_tab[0][3]_neon:   334.3 ( 2.71x)    296.1 ( 3.07x)
put_pixels_tab[1][1]_neon:   168.3 ( 1.78x)     94.1 ( 3.19x)
put_pixels_tab[1][3]_neon:   112.3 ( 2.20x)     90.0 ( 2.74x)

(cherry picked from commit 840183d823)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cc221d1551)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Niklas Haas
7ee2f9004b swscale/alphablend: don't overread alpha plane on subsampled odd size
This function overreads the input plane for odd dimensions, because the
chroma plane is always rounded up, which means (xy << subsample) + 1 exceeds
the actual alpha plane size.

To verify:
  valgrind ffmpeg -pix_fmt yuva420p -f lavfi -i color -vf \
  "scale=1x1,format=yuva420p,scale=alphablend=uniform_color,format=yuv420p \
  -vframes 1 -f null -

Fixes: https://trac.ffmpeg.org/ticket/11692
(cherry picked from commit b7946098b1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2a1d9c080f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
James Almer
f4374ba824 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>
(cherry picked from commit 7f9c7f9849)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 92bc9031be)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Kacper Michajłow
60e8e42e95 avformat/mov: ensure required number of bytes is read
Fixes: use-of-uninitialized-value

Found by OSS-Fuzz.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b534e402d8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ae7d4e53eb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Michael Niedermayer
07916fa309 avformat/av1dec: Check bits left before get_leb128()
Fixes: use of uninitialized value
Fixes: 70872/clusterfuzz-testcase-minimized-ffmpeg_dem_OBU_fuzzer-6005782487826432

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 6996e1238e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d67be03ad6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Kacper Michajłow
2afed2ab63 avformat/nuv: return early if header id fails to read
Fixes use of uninitialized value in memcmp below, reported by MSAN.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 02b3fc5826)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9a4e0f6cb8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Andreas Rheinhardt
3ec3d9bdc3 avformat/dhav: Check amount read
Prevents potential use of uninitialized data in the following
memcmp().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit d8cad01805)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6c1c0470e8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Kacper Michajłow
9e30870fa2 avformat/hls: update current segment reference before use
It may be invalidated by the time it is used.

Fixes use after free when accessing current segment.

Fixes: #10825
Signed-off-by: J. Dekker <jdek@itanimul.li>
(cherry picked from commit b2b23f353a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6c395546f0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00
Reimar Döffinger
ce63eec845 avcodec/parser: Reset *buf_size on realloc failure
Fixes: out of array access
Fixes: crash-0d640731c7da52415670eb47a2af701cbe2e1a3b
Fixes: crash-e745864ead6ea418959c8df56de2765571201dae

Found-by: Catena cyber <contact@catenacyber.fr>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 605fc72f19)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 852b178240)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-21 02:56:26 +02:00