diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-11-27 23:34:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-03-27 13:37:24 +0200 |
commit | 9097001f8012b4af57ac2e8076159ee9c7054b54 (patch) | |
tree | 8060027ec7fcdf17cb8cdf5ec89767e2be49905e /libavcodec | |
parent | 54326fd8d8e8cf32cfbeed814aa562e612bc6b99 (diff) | |
download | ffmpeg-9097001f8012b4af57ac2e8076159ee9c7054b54.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>
Diffstat (limited to 'libavcodec')
-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 cf06af0a71..cf64645524 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -3019,6 +3019,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; |