PR #26110 opened by michaelni URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26110 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26110.patch
>From 8451c091383a01b50bdba360bf9f316c8ebe850d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Mon, 16 Nov 2026 16:22:55 +0100 Subject: [PATCH 1/3] avcodec/exif: check the MakerNote size against each vendor header The Apple header is 14 bytes long, only 12 bytes were ensured. Out of array read Replicated through UnModified FFmpeg with ASAN Fixes: out of array read Fixes: 574983318/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-6338666226843648 Fixes: W5fFPYXZ8Df6 Regression since: e5a3f55c017ddaf9eeecba2a2977d7734f5f7453 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/exif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/exif.c b/libavcodec/exif.c index 58151914c57..6bf789ad388 100644 --- a/libavcodec/exif.c +++ b/libavcodec/exif.c @@ -466,7 +466,8 @@ static int exif_get_makernote_offset(GetByteContext *gb) return -1; for (int i = 0; i < FF_ARRAY_ELEMS(makernote_data); i++) { - if (!memcmp(gb->buffer, makernote_data[i].header, makernote_data[i].header_size)) + if (bytestream2_get_bytes_left(gb) >= makernote_data[i].header_size && + !memcmp(gb->buffer, makernote_data[i].header, makernote_data[i].header_size)) return makernote_data[i].result; } -- 2.54.0 >From 7c2fe744dff0455ee135e081e06c4aad9649a89b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Mon, 16 Nov 2026 16:23:28 +0100 Subject: [PATCH 2/3] avcodec/cbs_apv: check that the tile dummy bytes are within the input Out of array read Replicated through API with ASAN Fixes: out of array read Fixes: 575066671/clusterfuzz-testcase-minimized-ffmpeg_BSF_APV_METADATA_fuzzer-4670056634843136 Fixes: xfPGyAEH1llq Regression since: b5d8c529339aafc9768a025b6e363f64a7fa3154 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/cbs_apv_syntax_template.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/cbs_apv_syntax_template.c b/libavcodec/cbs_apv_syntax_template.c index bcc72a015d9..69d38dd851b 100644 --- a/libavcodec/cbs_apv_syntax_template.c +++ b/libavcodec/cbs_apv_syntax_template.c @@ -259,6 +259,8 @@ static int FUNC(tile)(CodedBitstreamContext *ctx, RWContext *rw, if (padding_size > 0) { #ifdef READ + if (get_bits_left(rw) < 8LL * padding_size) + return AVERROR_INVALIDDATA; current->tile_dummy_byte = (uint8_t*)align_get_bits(rw); current->tile_dummy_byte_size = padding_size; skip_bits_long(rw, 8 * padding_size); -- 2.54.0 >From 550eb38b429c655c8bcc88eb410e4ccb5fe00cbc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Mon, 16 Nov 2026 16:23:44 +0100 Subject: [PATCH 3/3] avcodec/cbs_apv: reject tiles smaller than their header Assertion failure Replicated through UnModified FFmpeg Found during triage of the OSS-Fuzz issue 575066671 Fixes: Assertion tile_size >= current->tile_header.tile_header_size + data_size failed Fixes: JG7KeTpWk1S2/apv-tilesize10.apv Fixes: JG7KeTpWk1S2 Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/cbs_apv_syntax_template.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/cbs_apv_syntax_template.c b/libavcodec/cbs_apv_syntax_template.c index 69d38dd851b..c9cb61aea5c 100644 --- a/libavcodec/cbs_apv_syntax_template.c +++ b/libavcodec/cbs_apv_syntax_template.c @@ -207,6 +207,8 @@ static int FUNC(tile_header)(CodedBitstreamContext *ctx, RWContext *rw, u(16, tile_index, tile_idx, tile_idx); + if (tile_size < current->tile_header_size) + return AVERROR_INVALIDDATA; tile_size_remaining = tile_size - current->tile_header_size; for (int c = 0; c < priv->num_comp; c++) { us(32, tile_data_size[c], 1, tile_size_remaining, 1, c); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
