Commit graph

54253 commits

Author SHA1 Message Date
Anthony Hurtado
495b402f27 avcodec/diracdec: fix heap buffer overflow in edge_emu_buffer
Fixes: poc_dirac_v2_*
2026-06-03 23:37:46 +00:00
Michael Niedermayer
47f3996bdd avcodec/tdsc: propagate max_pixels to the JPEG tile decoder
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-03 20:35:41 +00:00
Michael Niedermayer
c1d3e8c46f avcodec/imm5: propagate max_pixels to the H264/HEVC sub-decoders
Fixes: 501794495/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IMM5_fuzzer-5192457796255744
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-03 20:35:41 +00:00
Michael Niedermayer
cdba2d76dc avcodec/cri: propagate max_pixels to the JPEG tile decoder
Fixes: 489941776/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-4845035614175232
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-03 20:35:41 +00:00
Michael Niedermayer
3669a742dd 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>
2026-06-03 20:34:28 +00:00
David Korczynski
6d8f7882ae avcodec/adpcm: require block_align to be a multiple of channels in ADPCM_PSXC init
The ADPCM_PSXC block loop in adpcm_decode_frame() (libavcodec/adpcm.c:
2770) iterates 'block < avpkt->size / block_align' times and, for
each block, consumes
    channels * (1 + (block_align - 1) / channels)
input bytes via the *unchecked* bytestream2_get_byteu() reader. The
loop divides avpkt->size by block_align, so the loop bound is sound
only when the per-block consumption equals block_align — i.e. when
block_align is an exact multiple of channels. For any other
combination (e.g. block_align=9 with channels=8), each block consumes
more than block_align bytes; iterating avpkt->size/block_align
blocks then walks the input bytestream past avpkt->data +
avpkt->size, producing the heap-buffer-overflow READ at
libavcodec/bytestream.h:99 reported as ANT-2026-04052.

adpcm_decode_init() previously only enforced 'channels > 0' and
'block_align > 0' for PSXC. Tighten the init check to additionally
require 'block_align % channels == 0', which is the precise
invariant the decode loop depends on.

Reproducer: a crafted WAV header declaring channels=8, block_align=9
with the decoder forced via 'ffmpeg -c:a adpcm_psxc -i evil.wav'.

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

Signed-off-by: David Korczynski <david@adalogics.com>
2026-06-03 20:33:19 +00:00
Zhao Zhili
520968debb avcodec/vc1dsp: always inline vc1_loop_filter
vc1_loop_filter() is only reached through the six C wrappers. Clang 14
keeps it out of line with plain static inline, adding a 224-byte stack
frame before the tiny bestcase path on rpi 5. gcc 12 already inlines
it.

rpi 5 clang 14:
                                before  after
vc1_v_loop_filter4_bestcase_c   27.2     8.3   (3.3x)
vc1_h_loop_filter4_bestcase_c   26.4    10.2   (2.6x)
vc1_v_loop_filter8_bestcase_c   32.5    20.3   (1.6x)
vc1_h_loop_filter8_bestcase_c   31.7    19.5   (1.6x)
vc1_v_loop_filter16_bestcase_c  42.1    33.2   (1.3x)
vc1_h_loop_filter16_bestcase_c  41.6    25.3   (1.6x)

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-06-03 10:41:08 +00:00
Zhao Zhili
200914853d aarch64/sbrdsp: unroll sum64x5 to 16 floats/iter
The C version is faster than the previous asm with clang and gcc > 12 on
rpi5, since compiler basically does the same unroll.

sum64x5_neon:             before          after
  Cortex-A76 (gcc 12.4):  72.3 (3.63x)    47.4 (5.56x)
  Cortex-A76 (gcc 14.2):  72.3 (0.69x)    47.4 (1.05x)
  Apple M1 (clang 16):     0.2 (0.98x)     0.2 (0.99x)

Signed-off-by: Zhao Zhili <quinkblack@foxmail.com>
2026-06-03 10:40:20 +00:00
Lynne
4d63e3dd4c
vulkan_ffv1: add Bayer encoder
Sponsored-by: Sovereign Tech Fund
2026-06-03 14:12:50 +09:00
Lynne
bade9e6bd0
vulkan_ffv1: detect float remap from pixfmt, not f->flt
The decode-shader picker fell over for integer remapped streams.

Sponsored-by: Sovereign Tech Fund
2026-06-03 14:12:50 +09:00
Lynne
713f191c24
vulkan_ffv1: add Bayer decoder
Sponsored-by: Sovereign Tech Fund
2026-06-03 14:12:50 +09:00
James Almer
151fe3a5ac avcodec/itut35: unref existing buffers before allocating new ones
Finishes fixing memleaks.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 23:24:19 -03:00
James Almer
9dd48f7d25 avcodec/itut35: add missing unref calls in ff_itut_t35_unref()
Fixes memleaks.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 23:23:32 -03:00
James Almer
a1e4aee2f0 avcodec/aac/aacdec: support height channels signaled with PCE
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 20:06:00 -03:00
James Almer
070bd112be avcodec/h2645_sei: use the ITU-T T35 parsing helpers
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
cf5284b491 avcodec/itut35: add support for HDR Vivid
Needed by h2645_sei.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
04ae5788df avcodec/itut35: add support for Active Format Description
Needed by h2645_sei.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
f1929d75a2 avcodec/itut35: add support for AOM film graim
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
c500c786ab avcodec/libaomdec: use the ITU-T T35 parsing helpers
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
e40dd45f0d avcodec/libdav1d: use the ITU-T T35 parsing helpers
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
19b3d47007 avcodec/av1dec: use the ITU-T T35 parsing helpers
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
James Almer
4fcd2349ff avcodec/itut35: add ITU-T T35 parsing helpers
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-02 19:50:39 -03:00
Anton Kesy
344a9ce2da avcodec/qsvenc: add unsupported codec level log
Adds missing log of struct mfxInfoMFX member: codec level.

Signed-off-by: Anton Kesy <anton@kesy.de>
2026-06-02 20:51:32 +00:00
Michael Niedermayer
69c9f1158c avcodec/aac/aacdec_usac: avoid signed overflow in decode_tsd
decode_tsd() computes the binomial coefficient c = C(k, p) incrementally.
this commit makes it less overflow prone

Fixes: 515703905/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_DEC_fuzzer-4890954254581760
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-02 00:59:38 +00:00
Michael Niedermayer
e711e60827 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>
2026-06-02 00:59:38 +00:00
Michael Niedermayer
620e59bbec avcodec/aac/aacdec: More detailed warning about sample rates
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-02 00:59:38 +00:00
Michael Niedermayer
263374ac7d avcodec/aac/aacdec_usac: reject explicit usacSamplingFrequency of 0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-02 00:59:38 +00:00
James Almer
bf608f16fd avcodec/cbs_h266_syntax_template: Fix pps_exp_slice_height_in_ctus_minus1 range
Found-by: Claude (Anthropic). Human-verified and reported by Omkhar Arasaratnam <omkhar@linkedin.com>.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-01 03:42:50 +00:00
Kacper Michajłow
6026988b75
avcodec/bsf: add dovi_split BSF
Allows splitting interleaved BL+EL HEVC bitstream into separate streams.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-05-31 16:58:23 +02:00
Michael Niedermayer
054dffd133 avcodec/bsf/dts2pts: fix binary tree invariant violation on selective dec_poc
Modifying the keys of a sorted structure, be that a tree or other
can lead to changes in the ordering and undefined behavior.
It can also lead to collisions with existing keys.

All these cases need to be handled unless there is a bug elsewhere
that would prevent them.

Fixes: out of array access
Fixes: 504281984/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-6032368162111488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-31 13:41:57 +00:00
Lynne
49a77d37be
ffv1enc: write f->flt to extradata
The parser has been reading f->flt for combined_version >= 0x40004
since commit c1b330bf24 (avcodec/ffv1: Basic float16 support), but
ff_ffv1_write_extradata() never had a matching put_symbol().
The result was that the parsed f->flt was whatever the next symbol's
worth of rangecoded bits happened to decode to — often 0, but for a
yuv420p16le -level 4 -strict experimental stream produced locally it
parses as 1.  The software decoder doesn't notice because the YUV
pixfmt-selection branches never check f->flt, but anything else that
trusts it gets garbage.

Sponsored-by: Sovereign Tech Fund
2026-05-31 20:04:02 +09:00
Lynne
0678077143
ffv1enc: add RCT coefficient search for Bayer
Sponsored-by: Sovereign Tech Fund
2026-05-31 20:04:02 +09:00
Lynne
4f509c9e43
ffv1dec: implement Bayer pixel format encoding
Sponsored-by: Sovereign Tech Fund
2026-05-31 20:04:02 +09:00
Lynne
d62686b50f
ffv1enc: implement Bayer pixel format encoding
Sponsored-by: Sovereign Tech Fund
2026-05-31 20:03:57 +09:00
James Almer
c65c8f1f49 avcodec/dcadec: output a custom channel layout when requesting coded channel ordering
Outputting an UNSPEC layout will make most callers guess the speaker layout, and
more likely than not get it wrong.
Now that we can freely export custom order layouts, lets use them.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-30 22:37:09 -03:00
Romain Beauxis
5f6dff5e7d avcodec/packet: add AV_PKT_DATA_HEVC_CONF side data type
Carries a raw HEVCDecoderConfigurationRecord for the Dolby Vision
enhancement layer, parsed from the hvcE box (ISOM) or the corresponding
BlockAdditionMapping (Matroska).
2026-05-30 17:37:28 +00:00
David Korczynski
1152139b48 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>
2026-05-30 13:57:13 +00:00
Andreas Rheinhardt
b8c5376eb4 avcodec/vorbis_parser: Improve returned error codes
av_vorbis_parse_init() doesn't return an error code which is a slight
problem in libvorbisenc.c. Fix this by making the internal
initialization function behind av_vorbis_parse_init() available. This
also avoids allocations and frees.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-05-30 13:10:07 +02:00
Lynne
d66552e676
vulkan/ffv1: add 32-bit float RGB encoding and a rice + remap path
This implements 32-bit float RGB encoding and makes the Vulkan implementation
on-par with the C implementation.

Sponsored-by: Sovereign Tech Fund
2026-05-30 12:10:01 +09:00
Michael Niedermayer
7a2424eb43 avcodec/apv_decode: avoid using apv_cbc
Fixes: out of array access
Fixes: evil.apv

Found-by: Claude (Anthropic). Human-verified and reported by Omkhar Arasaratnam <omkhar@linkedin.com>. on 05-20
Found-by: Anthropic agents; validated and reported by Ada Logics. on 05-26
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-29 20:10:14 +00:00
Michael Niedermayer
6631bbc5d4 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>
2026-05-28 22:31:36 +00:00
Michael Niedermayer
0834dbed1c avcodec/bsf/smpte436m_to_eia608: properly frees stuff on errors in ff_smpte436m_to_eia608_filter()
Fixes: memleaks
Fixes: 501913473/clusterfuzz-testcase-minimized-ffmpeg_BSF_SMPTE436M_TO_EIA608_fuzzer-5607133705207808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-28 22:24:58 +00:00
James Almer
af4caa17a7 avcodec/libfdk_aac: simplify setting the layout mask
We can combine some cases in these switches as they set the same flags.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-28 13:23:42 +00:00
James Almer
3e402514e5 avcodec/aacencdsp: move init methods outside of the header
Signed-off-by: James Almer <jamrial@gmail.com>
2026-05-28 00:04:06 -03:00
Tim Walker
5f14108864 avcodec/libfdk-aacdec: support streams with 5 front channels 2026-05-27 21:06:41 +02:00
Ramiro Polla
0ac3b00a18 avcodec/mjpegdec: simplify bayer width handling
Double s->avctx->width directly, simplifying width-related code in
ljpeg_decode_rgb_scan().
2026-05-26 11:19:14 +02:00
Ramiro Polla
2065ead16e avcodec/mjpegdec: remove redundant vpred variable for bayer
The vpred variable in ljpeg_decode_rgb_scan() is redundant with
buffer[0][i], which is used by the generic codepath.
2026-05-26 11:19:14 +02:00
Lynne
9a6b5ca197
vulkan/ffv1_enc_rct_search: fix slice dimension iterations
This was a mess, we were using incorrect pixels outside of the image boundaries as
valid, the iteration had undefined behaviour since it was non-uniform across the workgroup.

Calculate the per-invoc iterations from the slice dimensions instead, making all of
them identical. And add a valid flag to decide whether to use them or not. And fix the
synchronization.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00
Lynne
9cabb12f74
vulkan/ffv1_enc_rct_search: write slice_rct_coef directly by main invoc
The issue is that SliceContext was passed as an inout, which caused all
invocs to locally copy and modify it.
When the main invoc wrote it, only the very last written value was used,
choosing the wrong coeffs.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00
Lynne
5fc56fbf96
vulkan/ffv1_enc_rct_search: barrier before reading score_mode
There was a race condition where the main invocation would race ahead and use
values not yet written by other invocs.

Sponsored-by: Sovereign Tech Fund
2026-05-26 17:47:04 +09:00