1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

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>
This commit is contained in:
Michael Niedermayer 2022-11-27 23:34:33 +01:00
parent f669dd4dff
commit 7c130d6911
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -2956,6 +2956,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;