Commit d217691e authored by Michael Niedermayer's avatar Michael Niedermayer

libavcodec/mpeg12dec: Check input for minimal frame size

Fixes: Timeout (35sec -> 6sec)
Fixes: 16901/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-5729024726269952
Fixes: 16901/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEGVIDEO_fuzzer-5642388592132096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 5fe6a9db
......@@ -1596,6 +1596,11 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
Mpeg1Context *s1 = (Mpeg1Context *) s;
int ret;
if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {
if (s->mb_width * s->mb_height * 11LL / (33 * 2 * 8) > buf_size)
return AVERROR_INVALIDDATA;
}
/* start frame decoding */
if (s->first_field || s->picture_structure == PICT_FRAME) {
AVFrameSideData *pan_scan;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment