diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-11-27 23:34:33 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-04-07 23:40:47 +0200 |
commit | a56d3a1ef129fdca6c18f17b9b1da104062f70ac (patch) | |
tree | 22c175cc1cea49c054c9c69dc938e2c0d5ad3b0a /libavcodec | |
parent | 4bcb493a0eb6fbbcd3a748927a245547adf81a0f (diff) | |
download | ffmpeg-a56d3a1ef129fdca6c18f17b9b1da104062f70ac.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 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; |