Commit Graph
47162 Commits
Author SHA1 Message Date
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
Aidan MacDonaldandMichael Niedermayer 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 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 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
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 ZhiliandMichael Niedermayer 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
James AlmerandMichael Niedermayer 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
Reimar DöffingerandMichael Niedermayer 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
Bogdan LismanandMichael Niedermayer 99cc2164b8 avcodec/snowenc: fix SIGFPE in get_dc() when a block lies outside the plane
get_dc() divides the accumulated, OBMC-weighted DC by aa, the sum of the
squared OBMC weights taken over the in-plane pixels.  When an OBMC block
falls entirely outside the plane - e.g. a tiny chroma plane after mcdeint
splits a frame into fields - no pixel contributes, aa stays 0 and the
ROUNDED_DIV() divides by zero (SIGFPE).  ab is 0 in exactly the same case,
so the result degenerates to 0; return it directly.

Reproducible with the GPL mcdeint filter in slow/extra_slow mode, e.g.

    ffmpeg -f lavfi -i testsrc=s=128x2 -vf mcdeint=mode=slow -f null -

Add a self-contained lavfi-based FATE regression test for the slow mode,
which previously crashed and is therefore not covered by the existing
sample-based fast/medium tests.

Fixes trac ticket #7779.

Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
(cherry picked from commit a62d996927)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 03:41:48 +02:00
Michael Niedermayer 34d55b2f33 avcodec/snowenc: fix out-of-bounds OBMC read in get_dc() for narrow planes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 30c6667dad)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 03:34:07 +02:00
Bogdan LismanandMichael Niedermayer dd53a29934 avcodec/snowenc: fix out-of-bounds memcpy in get_block_rd() for narrow planes
For an edge block, get_block_rd() copies the full-OBMC-weight central
region directly from cur[] into the reconstruction.  It moved one
boundary to block_w/block_h but overwrote the in-plane clip (x0/x1/y0/y1
computed earlier from the plane size) instead of intersecting with it.
When a plane is narrower than block_w - e.g. a tiny field/chroma plane
produced by the mcdeint filter - the right-edge case left x0 = block_w
while x1 stayed clipped to w - sx < block_w, so x1 - x0 became negative
and was passed to memcpy() as a huge size_t, crashing with SIGSEGV.

Intersect the moved boundaries with the existing clip so the copy region
stays inside the plane and the memcpy length can never be negative.

Reproducible with the GPL mcdeint filter in slow/extra_slow mode, e.g.

    ffmpeg -f lavfi -i testsrc=s=5x32 -vf mcdeint=mode=slow -f null -

This is a separate crash from the get_dc() SIGFPE (ticket #7779) reached
through the same iterative_me() path.  Add a lavfi-based FATE regression
test.

Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
(cherry picked from commit 1168447626)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 01:34:18 +02:00
Michael Niedermayer 97db5a5f30 avcodec/cbs_av1_syntax_template: reset seen_frame_header on sequence
headers

With this change CBS and the decoder appear to be in sync.

Fixes: division by 0

Fixes: 501794431/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-4792576644546560
Fixes: 501898692/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-4772278394224640
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 fd290e2fcd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-15 23:52:17 +02:00
Michael Niedermayer da6afb5a80 avcodec/rv10, rv34: check init_get_bits8() before RealVideo bit access
Found-by: Samarth Kumbla <samarthk@cantina.security>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0c662529f6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 04:23:39 +02:00
David KorczynskiandMichael Niedermayer d456300d53 avcodec/agm: validate actual src_y against prev plane in decode_inter_plane
Found-by: Anthropic agents; validated and reported by Ada Logics.

Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4527854281)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 03:29:44 +02:00
Michael Niedermayer ed2b022ed7 avcodec/hevc/ps: Check window parameters
Fixes: signed integer overflow: -1094995529 * 2 cannot be represented in type 'int'
Fixes: 484567435/clusterfuzz-testcase-minimized-ffmpeg_dem_HXVS_fuzzer-5628836988649472

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 82f097c825)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 02:58:53 +02:00
Michael Niedermayer 5094a7af85 avcodec/hevc/ps: Factor window reading out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 8c868a1fd2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 02:50:44 +02:00
David KorczynskiandMichael Niedermayer 5ec9651f7b avcodec/truespeech: reject iterations count whose * 240 product overflows 32-bit
Found-by: Anthropic agents; validated and reported by Ada Logics.
Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d30dead35e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 01:28:18 +02:00
David KorczynskiandMichael Niedermayer 67c57b85c9 avcodec/on2avc: reject subframe count whose * SUBFRAME_SIZE product overflows 32-bit
Found-by: Anthropic agents; validated and reported by Ada Logics.
Signed-off-by: David Korczynski <david@adalogics.com>
(cherry picked from commit 331b3e9dea)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 01:17:14 +02:00
Michael Niedermayer 405a968ebf avcodec/adpcm: fix signed integer overflow in get_nb_samples()
Fixes: signed integer overflow: 314572800 * 8 cannot be represented in type 'int'

Tighten the guard to INT_MAX/14, which covers the largest expansion
factor used in the function currently.

Found-by: Jiale Yao <19888972804@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 04e2341056)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 00:28:53 +02:00
David KorczynskiandMichael Niedermayer 42a6a5ba28 avcodec/fastaudio: reject subframes count whose * 256 product overflows 32-bit
fastaudio_decode() computes
    subframes = pkt->size / (40 * channels);
    frame->nb_samples = subframes * 256;
both as 32-bit signed multiplications. When pkt->size is large enough
to make subframes >= 2^24, the second multiplication overflows the
signed int range and frame->nb_samples wraps to a small value.
ff_get_buffer() then sizes the audio plane for that wrapped sample
count, while the decoder loop at line 152 still iterates the full
(unwrapped) subframes count, performing a 1024-byte memcpy per
subframe per channel. The 27th iteration (or first iteration with
nb_samples=0) writes one byte past the per-plane allocation,
yielding the ASan heap-buffer-overflow WRITE at libavcodec/fastaudio
.c:171 reported as ANT-2026-03891.

Reject the subframes value whose *256 product would overflow before
performing the multiplication. The bound INT_MAX / 256 (= 8388607)
keeps the existing two's-complement semantics of every reachable
input and rejects only the configurations that would have wrapped.

Reproducer: a crafted AVI declaring one mono audio chunk of
671_088_680 bytes (sparse) with the decoder forced via
'ffmpeg -c:a fastaudio -i evil.avi'.

Found-by: Anthropic agents; validated and reported by Ada Logics.

Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1e9984772b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 00:26:13 +02:00
Michael Niedermayer 091a4bd720 avcodec/vc2enc_dwt: avoid signed overflow in the 9/7 DWT lifting
Fixes: 490488944/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC2_fuzzer-5310290362433536
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 5f91556215)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-14 00:25:10 +02:00
Michael Niedermayer 82ac26f2f6 avcodec/mwsc: do not dereference a missing reference frame
Fixes: 493841393/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MWSC_fuzzer-5079884677578752
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 ba825ce85f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 19:40:07 +02:00
Anthony HurtadoandMichael Niedermayer 1162a8890a avcodec/diracdec: fix heap buffer overflow in edge_emu_buffer
Fixes: poc_dirac_v2_*
(cherry picked from commit 495b402f27)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 19:20:56 +02:00
Michael Niedermayer 47e83a7244 avcodec/jpeglsdec: only apply color transform to decoded rows
Fixes: Timeout
Fixes: 503996733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_DEC_fuzzer-4948713016721408
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 3669a742dd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 19:18:11 +02:00
Michael Niedermayer 831838871a avcodec/aac/aacdec: reject decoded frame without a valid sample rate
Later code will turn this into AVERROR_BUG

When returning sample_rate == 0 samples is considered a bug, we have no
nice choice but to error out cleanly

Fixes: assertion failure
Fixes: ffmpeg_AV_CODEC_ID_AAC_DEC_fuzzer crash-0a86d46fef2442b222ee34403c21f7f582ffccb0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e711e60827)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 18:54:15 +02:00
David KorczynskiandMichael Niedermayer ffa04f8cf0 avcodec/cook: bound subpacket channel sum against channel count
Fixes: out of array read
Fixes: evil.rm

Found-by: Anthropic agents; validated and reported by Ada Logics.

Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1152139b48)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 18:29:14 +02:00
Michael Niedermayer b327d1b523 avcodec/jpeg2000dec: Clear header derived variables
Fixes: NULL pointer dereference

Found-by: Oguzhan Akkaya with AFL++ fuzzing (May 2026)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 6631bbc5d4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 17:09:24 +02:00
Hassan HanyandMichael Niedermayer 41119fe841 avcodec/x86/vorbisdsp: change cmpleps to cmpltps in inverse coupling
Changed the comparison from cmpleps to strictly less than
(cmpltps) to strictly follow the Vorbis spec

Fixes https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21501

(cherry picked from commit 9288681068)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 15:29:48 +02:00
Ori HollanderandMichael Niedermayer 922ef1fa41 avcodec/magicyuv: reject slice_height misaligned with chroma vshift
Fixes: poc_magicyuv.avi
Fixes: out of array access

Found-by: Ori Hollander of the JFrog Vulnerability Research team
(cherry picked from commit 374b726ffa)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 14:55:37 +02:00
Michael Niedermayer 5aacf46a53 avcodec/magicyuv: Expand the s->interlaced slice-height sanity check
Fixes: poc_magicyuv.avi
Fixes: out of array access

Found-by: Ori Hollander of the JFrog Vulnerability Research team
(cherry picked from commit 5806e8b9f3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 14:54:50 +02:00
Michael Niedermayer 0216a4847e avcodec/magicyuv: Fix 1 line MEDIAN slices
No testcase

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c23d4da312)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 14:53:51 +02:00
Michael Niedermayer fed66a05a1 avcodec/jpeg2000dec: compute mask in decode_clnpass() like in decode_sigpass()
Fixes: integer overflow

Found by: Jiale Yao
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 59367afc3d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 00:18:33 +02:00
David KorczynskiandMichael Niedermayer abde662846 avcodec/g2meet: The stack is EPIC_PIX_STACK_SIZE
Fixes: out of array access
Fixes: ada-5-poc.avi

Found-by: Claude and Ada Logics. This issue was found by Anthropic from using agents to study security of open source projects, and I am from Ada Logics helping validate the found issues and report to maintainers.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 989e621bcd)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 00:14:18 +02:00
Thai DuongandMichael Niedermayer 54b1591f0d avcodec/diracdec: Enlarge mctmp to cover the worst-case blheight·ybsep + yblen rows, and break the MC loop when no output rows remain
Fixes: ffmpeg_ANT-2026-02842_dirac-mctmp-heap-overflow

Discovered by Claude (Anthropic). Confirmed and reported by Thai Duong (Calif.io).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bbdce45fda)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-13 00:04:35 +02:00
Zhao ZhiliandMichael Niedermayer 452430b9b1 avcodec/hevc: limit missing-ref fill to coded planes
generate_missing_ref walked frame->f->data[] until a NULL slot, which
on alpha-video frames extended to data[3] and read
sps->hshift[3]/vshift[3] out of bounds.

The alpha plane is produced by the alpha layer via
replace_alpha_plane; the base decoder path never reads or writes it.
Bound the fill loop by the SPS coded plane count. This both removes
the out-of-bounds shift access and avoids an unnecessary full-frame
memset of the alpha plane.

Fixes: out of array read
Fixes: 500770604/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6157374833623040
(cherry picked from commit 3b939ced79)
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
(cherry picked from commit afe5c07ad7bf973bfa0e490fbc8e50c2432d819d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-12 23:40:56 +02:00
James AlmerandMichael Niedermayer 74c75e9cea avcodec/av1dec: check that primary_ref_frame is within range
Fixes CVE-2026-30997

Fixes: Out-of-Bounds Access
Found-by: Xinghang Lv
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 1a2c16fe51)
(cherry picked from commit 3c4ca300f4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 16:03:30 +02:00
Michael Niedermayer d6e4e951c7 avcodec/dfpwmdec: Check nb_samples
Fixes: integer overflow

Found-by: Dhiraj Mishra <mishra.dhiraj95@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 118bddf0ce)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 16:03:30 +02:00
Michael Niedermayer 67a7394c59 avcodec/alsdec: do not set nbits invalidly
note that the spec actually disallows the 0 case too but we are
a little lenient here so the full 24bit twos-complement range can be handled

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7ae36ceba9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 16:03:30 +02:00
Marius MomeuandMichael Niedermayer 9b8edde2b7 avcodec/ralf: Add the missing return statement after the error log
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ff3223b5d6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 16:03:29 +02:00
Michael Niedermayer 92c7be0d2e avcodec/zmbv: reject XOR data that overruns the decompression buffer
Add a per-block bounds check at the start of each XOR block so the
read is rejected before src crosses decomp_len, and propagate the
error from decode_frame().

Fixes: out of array read

Found-by: Seung Min Shin
(cherry picked from commit 2a991a3475)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 16:03:28 +02:00
Michael Niedermayer 0db9de2219 avcodec/rasc: fix heap use-after-free in decode_move()
Use a separate scratch buffer (s->mv_scratch) for the type-0 pixel
copy so s->delta and mc are not disturbed for the lifetime of
decode_move().  The new buffer is freed in decode_close().

Found-by: Seung Min Shin
Patch based on suggsted fix by Seung Min Shin

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2f60af465a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 15:21:19 +02:00
Michael Niedermayer 1d5ca88a89 avcodec/h264: recompute per-slice direct mode state for every slice
Regression since: 7f05c5cea0
Fixes: poc10
Fixes: null pointer dereference

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1772386392)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 15:21:18 +02:00
Michael Niedermayer d9e30a50a6 avcodec/h264_refs: Clear stale pointers from ref_list
Testcase: poc10.bin

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 1886c3269d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 15:21:18 +02:00