[FFmpeg-cvslog] avcodec/mpeg12dec: Check input size
Michael Niedermayer
git at videolan.org
Sat Apr 8 01:08:49 EEST 2023
ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Nov 27 23:34:33 2022 +0100| [a56d3a1ef129fdca6c18f17b9b1da104062f70ac] | committer: Michael Niedermayer
avcodec/mpeg12dec: Check input size
Fixes: Timeout
Fixes: 53599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IPU_fuzzer-4950102511058944
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 7c130d6911f5b09bfc648f6ae678c4c0749f61bb)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a56d3a1ef129fdca6c18f17b9b1da104062f70ac
---
libavcodec/mpeg12dec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 09bf01247d..e8f99dc5cf 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2999,6 +2999,10 @@ static int ipu_decode_frame(AVCodecContext *avctx, void *data,
AVFrame * const frame = data;
int ret;
+ // Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
+ if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
+ return AVERROR_INVALIDDATA;
+
ret = ff_get_buffer(avctx, frame, 0);
if (ret < 0)
return ret;
More information about the ffmpeg-cvslog
mailing list