diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-11-27 23:34:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-03-16 14:48:41 +0100 |
commit | 43ea18703c376b9a8fbfb9287efc1c534378e775 (patch) | |
tree | 27e7abe4b367a183cf397f89fae8e93f9234f709 | |
parent | 405bfbd87356019668ee80ebf2bc9479f778146b (diff) | |
download | ffmpeg-43ea18703c376b9a8fbfb9287efc1c534378e775.tar.gz |
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@niedermayer.cc>
(cherry picked from commit 7c130d6911f5b09bfc648f6ae678c4c0749f61bb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mpeg12dec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index ed1d09fc62..0e8627c4a4 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2978,6 +2978,10 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame, GetBitContext *gb = &m->gb; 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; |