[FFmpeg-devel] [PATCH 06/10] avcodec/imm4: Check input size
Michael Niedermayer
michael at niedermayer.cc
Mon Sep 23 00:56:41 EEST 2024
Fixes: Timeout
Fixes: 71324/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IMM4_fuzzer-5388489435185152
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/imm4.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index a6da8fcf95b..573b6148339 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -453,6 +453,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (ret < 0)
return ret;
+ if (((avctx->width + 15) / 16) * ((avctx->height + 15) / 16) > get_bits_left(gb))
+ return AVERROR_INVALIDDATA;
+
+
if ((ret = ff_get_buffer(avctx, frame, (frame->flags & AV_FRAME_FLAG_KEY) ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
return ret;
--
2.46.1
More information about the ffmpeg-devel
mailing list