Commit Graph
128509 Commits
Author SHA1 Message Date
Martin Mirchev cc30be196d avfilter/vf_curves: unmap the psfile with the mapped pointer and size
parse_psfile() advances buf and decrements size while reading the
file, and then passed these to av_file_unmap() instead of what
av_file_map() returned. With mmap, munmap() then fails with EINVAL
because the pointer is no longer page aligned, so the mapping leaks on
every init and every psfile command; on builds without mmap, av_free()
is called on a pointer into the middle of the buffer.

Keep the mapped pointer and size and unmap those.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-11-06 03:25:05 +00:00
Martin Mirchev c1a03c29ed doc/filters: concat next fails on the last segment
Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-11-06 01:58:48 +00:00
Michael Niedermayer 78454c68f2 tests/fate: cover concat next on the last segment
Send next while the final segment is active and compare all output frames. This covers rejection without truncating the remaining segment, using generated sources and no external samples.

Assisted-by: Fairy
2026-11-06 01:58:48 +00:00
Martin Mirchev 58c989a73d avfilter/avf_concat: reject the next command on the last segment
process_command() called flush_segment() without checking that there is a
next segment. On the last segment this moved cur_idx past the inputs while
the outputs still wanted frames, so activate() accessed cat->in[] and
ctx->inputs[] out of bounds and crashed, e.g.

  ffmpeg -f lavfi -i "testsrc2=d=0.2[a];testsrc2=d=1[b];[a][b]concat=n=2,sendcmd=c='0.3 concat next'" -f null -

Fail the command instead.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-11-06 01:58:48 +00:00
Michael Niedermayer 9f690c6a4c avcodec/sanm: use sizeof for the codec 23 LUT sizes
Suggested-by: Marvin Scholz
2026-11-05 23:27:36 +00:00
Michael Niedermayer afdc555aac avcodec/vc1dec: free the slice buffer when init_get_bits8() fails
Fixes: Ju3bQZ3z2paC
Fixes: AISLE-2026-0150-00166
Fixes: memory leak
Memory leak Replicated through UnModified FFmpeg with ASAN (AVI with one
268435475 byte WVC1 packet holding a single slice start code)

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:27:36 +00:00
Michael Niedermayer db77b0b831 avcodec/mimic: set up the bit reader before publishing the frame
Fixes: ZiiTReozL7KE
Fixes: AISLE-2026-0150-00435
Fixes: deadlock
Deadlock Replicated through UnModified FFmpeg with timeout (AVI with a
268435476 byte Mimic intra frame followed by inter frames; ffmpeg with
frame threading never exits)

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:27:36 +00:00
Michael Niedermayer 0bfa350291 avcodec/cfhd: allocate the inverse transform scratch buffer zeroed
Fixes: 1ivYPVLs04AI
Fixes: AISLE-2026-0150-00896
Fixes: use of uninitialized memory
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN
(CFHD AVI sample with the ImageHeight tag raised from 720 to 1080)

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:27:36 +00:00
Michael Niedermayer d42cb19259 avcodec/sanm: apply the codec 23 LUT loaded from the frame
Fixes: 4dmaFsb0C0KW
Fixes: AISLE-2026-0150-00882
Fixes: use of uninitialized memory
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:27:36 +00:00
Michael Niedermayer 592208bf7f fate: add tests for the wavelet mode of vf_vignette
A vignette is applied to the test source and reversed with both
transforms, the PSNR against the source is compared with a tolerance.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer 95c86cb722 fate: let refcmp_metadata take the filter under test
The filter applied to the test source before the comparison becomes an
optional parameter, defaulting to the avgblur used so far.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer 734743bb89 avfilter/vf_vignette: add a decimated transform option to the wavelet mode
A level works in place on the lowpass lattice of the previous one, so
the mode needs 5 planes instead of 9 + 3 * levels and about an order of
magnitude less computation. Shrinkage is less effective without the
shift invariance of the undecimated transform.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer 042548c65f avfilter/vf_vignette: slice threading for the wavelet mode
Every pass over a plane, the row and column passes of the transforms as
well as the box filters and the per coefficient operations of the
shrinkage, is split into slices of lines. The output does not depend on
the number of threads.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer ba940deb9f avfilter/wavelet97: add a decimated transform
Lowpass coefficients are stored at even and highpass ones at odd
positions of the line, so a level works in place on the lattice of the
previous level's lowpass coefficients. Reconstruction from a single
polyphase set needs no averaging, hence no factor 0.5.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer 205172946b avfilter/wavelet97: expose the per line analysis and synthesis
Lets a filter run the row and column passes over ranges of lines, as
slice threading needs.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer 5e56cabf83 avfilter/vf_vignette: add a wavelet mode reversing the vignette with noise suppression
Dividing by the attenuation amplifies the noise and the quantization
steps of the dark areas by the same factor. The wavelet mode performs
the division in the pixel domain, then transforms the result and its
per pixel noise variance, propagated through the squared filter taps as
if the samples were uncorrelated, with the undecimated 9/7 wavelet.
Each detail coefficient is Wiener shrunk toward 0 with a signal
variance estimated from a 7x7 box of coefficients at the dilation of
the level, weighted by their precision and counted only when it exceeds
the noise by 3 standard errors of independent coefficients. The lowpass
of the top level averages over large areas and is kept, so the shade of
heavily attenuated areas survives.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer c1fd7be5c0 avfilter/owdenoise: move the undecimated 9/7 wavelet transform into wavelet97.c
Makes the transform usable by other filters. The analysis filter taps become
a parameter so the same code can also propagate variances with squared taps.

Assisted-by: Claude
2026-11-05 23:12:03 +00:00
Michael Niedermayer 7c7b6befaa fate/ffv1: test the default slice layout of 32bit float frames
The size and checksum of the encoded file pin the slice layout and the
remap coding of a 704x576 float frame, which the 360x288 default slice
limit splits into 2x2 slices.
2026-11-05 23:09:16 +00:00
Michael Niedermayer 6364d8606c avcodec/ffv1enc: reject 32bit float Golomb-Rice slices above 2^18 pixels
The escape code of a Golomb-Rice residual is 12 + bits long and
put_bits() writes at most 31 bits, so bits must stay below 20. The RCT
planes of remapped 32bit floats need log2 of the summed remap counts of
two planes, which a slice of at most 1<<18 pixels keeps within 19 bits.
The default slice size of 360x288 is within that, larger slices requested
with -slices were written with escape codes longer than put_bits()
supports. The assertion on k follows the same limit.
2026-11-05 23:09:16 +00:00
Michael Niedermayer 60d62ca406 avcodec/ffv1dec: clamp k in get_vlc_symbol() at 20 instead of bits
Add a FATE test with such planes.
2026-11-05 23:09:16 +00:00
Michael Niedermayer bd6e6f638e avcodec/golomb: read Golomb-Rice codes of up to 32 bits in get_ur_golomb()
Add a FATE test that codes such a residual at every bit offset.
2026-11-05 23:09:16 +00:00
Michael Niedermayer 507e9ad286 avcodec/vvc/dec: require all slices of a frame to use the same PH and PPS
The testcases reproduce since b0c77e5a12.

Fixes: out of array read
Fixes: fAak9zecyttL/testcase/poc.vvc
Fixes: fAak9zecyttL/testcase/poc-entry-points.vvc
Fixes: fAak9zecyttL
Found-by: mzfr <security@mzfr.me>
2026-11-05 23:04:20 +00:00
Michael Niedermayer 2c515eea07 avcodec/cbs_sei: clear the message slot handed out by ff_cbs_sei_list_add()
Fixes: heap-use-after-free
Fixes: YtyT0QH1InrQ
Fixes: ANT-2026-13DK7NZD
Fixes: poc.264
Found-by: Claude and Ada Logics

Use after free Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 3092ee5a9c avfilter/vf_tonemap: pass the alpha row width, not the linesize, to av_image_copy_plane()
Fixes: negative-size-param
Fixes: assertion failure
Fixes: wzomtdUBffdP
Fixes: ANT-2026-G2YFQ5N2
Fixes: poc.exr
Found-by: Claude and Ada Logics

Negative size memcpy and assertion failure Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer f6d70de099 avcodec/huffyuvdec: budget 33 bits per sample when choosing the unchecked 16 bit loop
Fixes: heap-buffer-overflow (read)
Fixes: BIqbuSbTJqAH
Fixes: ANT-2026-V2EPGE9M
Fixes: poc.avi
Found-by: Claude and Ada Logics

Out of array read Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 1436f56075 avcodec/aacsbr: turn SBR off when the USAC SBR data cannot be parsed
Fixes: heap-buffer-overflow (write)
Fixes: GITTfi6VsK4u
Fixes: ANT-2026-5KX1BXM6
Fixes: poc.flv
Found-by: Claude and Ada Logics

Out of array write Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 19ed6f17d3 avutil/frame: compute the cropping offsets as ptrdiff_t
Found during triage/review of the security report NzELYSvufGfQ
(ANT-2026-324B3XNF), which does not report this.

Fixes: pointer overflow
Pointer overflow Replicated through UnModified FFmpeg with UBSAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 4968cc472b avcodec/mjpegdec: set the AVID frame height and cropping before flipping
Fixes: heap-buffer-overflow (read)
Fixes: NzELYSvufGfQ
Fixes: ANT-2026-324B3XNF
Fixes: ant-324b3xnf-avrn-64x32-flipped.avi
Found-by: Claude and Ada Logics

Out of array read Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer a82e676a82 avcodec/vvc/ps: do not truncate the virtual boundary position limit to 16 bits
Fixes: negative-size-param
Fixes: left shift of negative value
Fixes: 0IMcpiRlVAb5
Fixes: ANT-2026-QY2HYS5A
Fixes: poc.mkv
Found-by: Claude and Ada Logics

Negative size memcpy Replicated through UnModified FFmpeg with ASAN and UBSAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 67f9665f8e avcodec/cbs_h266: reject SPS virtual boundaries when the resolution may change
Fixes: negative-size-param
Fixes: left shift of negative value
Fixes: 0IMcpiRlVAb5
Fixes: ANT-2026-QY2HYS5A
Fixes: poc.mkv
Found-by: Claude and Ada Logics

Negative size memcpy Replicated through UnModified FFmpeg with ASAN and UBSAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 20b8812f5c avcodec/cbs_h266: reject an empty SPS conformance window
Fixes: heap-buffer-overflow (read)
Fixes: q0RFgfMenefI
Fixes: ANT-2026-HRT03RV0
Fixes: vvc-subpic-tiles.mkv
Found-by: Claude and Ada Logics

Out of array read Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer a10c197f1e avfilter/vf_median: reject widths whose fine histogram size overflows an int
Fixes: heap-buffer-overflow (read and write)
Fixes: signed integer overflow
Fixes: IhY7QcsV5nva
Fixes: ANT-2026-RYWQTXHH
Fixes: poc-median-65600x4.pgm
Found-by: Claude and Ada Logics

Out of array access Replicated through UnModified FFmpeg with ASAN and UBSAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 12e5d4ec98 avcodec/lcldec: check the packet size before reading the ZLIB multithread header
Fixes: heap-buffer-overflow (read)
Fixes: G8jPOZLbzYtj
Fixes: ANT-2026-22YEN9NA
Fixes: lcl-zlib-mt-shortlace.mkv
Found-by: Claude and Ada Logics

Out of array read Replicated through UnModified FFmpeg with ASAN
2026-11-05 23:03:11 +00:00
Michael Niedermayer 3c9ed5305c tests/fate: cover audio encoder boundary cases
Exercise the short DVD PCM tail, one-sample TTA frame, early RoQ flush and mono Microsoft ADPCM trellis paths fixed by PR 25694. Existing audio round trips do not cover these boundaries.

Generate input with sine and atrim, and compare packets through the framecrc muxer. No new samples or bitstream generator are needed.

Assisted-by: Fairy
2026-11-05 23:01:56 +00:00
Michael Niedermayer 90f5e61a1d avcodec/vorbis_parser: parse the extradata only once
Fixes: Timeout
Fixes: nsq7AyzgMo4U
Fixes: AISLE-2026-0150-00507
Timeout Replicated through UnModified FFmpeg

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:56 +00:00
Michael Niedermayer e621da8ecd avcodec/wavpackenc: compute the default block size in 64 bit
Fixes: signed integer overflow
Fixes: infinite loop
Fixes: dVqGncTUAyg9
Fixes: AISLE-2026-0150-00591
Signed integer overflow and infinite loop Replicated through API with UBSAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:56 +00:00
Michael Niedermayer fb13409aaf avcodec/adpcmenc: encode all samples of a mono ADPCM_MS block with trellis
Fixes: use of uninitialized memory
Fixes: 98u4sU59NEf4
Fixes: AISLE-2026-0150-00113
Use of uninitialized memory Replicated through UnModified FFmpeg with Valgrind

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:56 +00:00
Michael Niedermayer f71410e028 avcodec/roqaudioenc: encode the buffered samples when flushed early
Encode the buffered samples once and return no packet when the buffer
is empty.

Fixes: use of uninitialized memory
Fixes: X43TLCpjYK88
Fixes: AISLE-2026-0150-00397
Use of uninitialized memory Replicated through UnModified FFmpeg with Valgrind

Found-by: Joshua Rogers (AISLE)
The fix was suggested in the report.
2026-11-05 23:01:56 +00:00
Michael Niedermayer 29a629e788 avcodec/ttaenc: check the packet space for each sample and the CRC
Fixes: Assertion failure
Fixes: bAfKKmQm4ZDe
Fixes: AISLE-2026-0150-00078
Assertion failure Replicated through UnModified FFmpeg

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:56 +00:00
Michael Niedermayer cfe6a6cd7d avcodec/pcm-dvdenc: do not encode a frame with fewer samples than a block
24 bit samples are stored in blocks of samples_per_block samples
and the sample count of a frame is rounded down to whole blocks. A last
frame with fewer samples than a block gives zero blocks, the do/while
loops still run and read past the frame until the block count wraps.

Return no packet for such a frame.

Fixes: out of array read
Fixes: ZplUzGvg2XP9
Fixes: AISLE-2026-0150-00112
Out of array read Replicated through UnModified FFmpeg with ASAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:56 +00:00
Michael Niedermayer f1205ee018 avcodec/bitpacked: check the packet size before using it as a UYVY422 frame
Fixes: out of array read
Fixes: 2dyV2eNJkKBV
Fixes: AISLE-2026-0150-00092
Out of array read Replicated through API with ASAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:14 +00:00
Michael Niedermayer ad7ce15a51 avcodec/psd: free the RLE buffer when the frame allocation fails
This is not a security issue: the leak needs the frame allocation to
fail.

Fixes: memleak
Fixes: 9UXawhjlJguX
Fixes: AISLE-2026-0150-00349
Memory leak Replicated through API with LSAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:14 +00:00
Michael Niedermayer aa4b80b54e avcodec/psd: reject an uncompressed image size above INT_MAX
Fixes: out of array write
Fixes: MymIHidCHVJu
Fixes: AISLE-2026-0150-00348
Out of array write Replicated through UnModified FFmpeg (32-bit) with ASAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:14 +00:00
Michael Niedermayer 62c308e041 avcodec/hap: bound the sum of the uncompressed chunk sizes
Fixes: out of array write
Fixes: fglxAK3pz5sP
Fixes: AISLE-2026-0150-00462
Out of array write Replicated through UnModified FFmpeg (32-bit) with ASAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:14 +00:00
Michael Niedermayer 27f612b306 avcodec/flicvideo: bound pixel writes at both ends of the frame storage
Fixes: out of array write
Fixes: GGsIHTeUwf0U
Fixes: AISLE-2026-0150-00642
Out of array write Replicated through API with ASAN

Found-by: Joshua Rogers (AISLE)
2026-11-05 23:01:14 +00:00
Michael Niedermayer 515dcad73d avcodec/adxdec: validate the sample rate before changing the channel layout
Null pointer dereference Replicated through UnModified FFmpeg with ASAN

Fixes: null pointer dereference
Fixes: kmrMEk1So1o7
Fixes: AISLE-2026-0150-00566

Found-by: Joshua Rogers (AISLE)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-11-05 22:59:52 +00:00
Michael Niedermayer db98784a72 avcodec/mlz: reject string codes beyond the dictionary
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN
Use of uninitialized memory Replicated through API with MSAN

Fixes: use of uninitialized memory
Fixes: ln0NC22XPto3
Fixes: AISLE-2026-0150-00420

Found-by: Joshua Rogers (AISLE)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-11-05 22:59:52 +00:00
Michael Niedermayer 01e1bb1261 avcodec/takdec: require the multichannel channel list to cover all channels
Use of uninitialized memory Replicated through UnModified FFmpeg with MSAN

Fixes: use of uninitialized memory
Fixes: aWhU4kuts0tn
Fixes: AISLE-2026-0150-00040

Found-by: Joshua Rogers (AISLE)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-11-05 22:59:52 +00:00
Michael Niedermayer 968e9e948e avcodec/apedec: reject legacy frames with more than 73728 samples
Excessive memory allocation (peak RSS 2.58 GB from a 52 byte file)
Replicated through UnModified FFmpeg with ASAN

Fixes: out of memory
Fixes: 2cNjGsVIMOVX
Fixes: AISLE-2026-0150-00053

Found-by: Joshua Rogers (AISLE)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-11-05 22:59:52 +00:00
Michael Niedermayer 1f4b2e22cf avformat/sbgdec: bound the default frame size
Excessive memory allocation (peak RSS 2.3 GB from a 69 byte script)
Replicated through UnModified FFmpeg with ASAN

Fixes: out of memory
Fixes: 6m4Av2yQJEhE
Fixes: AISLE-2026-0150-00550

Found-by: Joshua Rogers (AISLE)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-11-05 22:59:52 +00:00