aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-09-22 22:47:03 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-09-24 15:37:19 +0200
commit8367d7e184562f8b9f410c0f325596f7e041884f (patch)
tree43f5eddfd058caf4a33cbda9bad79d817a3c7525
parent050b5e85cbe61414ba9b78f76a04b2488e816f42 (diff)
downloadffmpeg-8367d7e184562f8b9f410c0f325596f7e041884f.tar.gz
avcodec/imm4: Check input size
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@niedermayer.cc>
-rw-r--r--libavcodec/imm4.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index a6da8fcf95..573b614833 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;