Commit 4a660fac authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/truemotion1: Check that the input has enough space for a minimal index_stream

Fixes: Timeout (18sec -> 0.4sec)
Fixes: 17585/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION1_fuzzer-5117015135617024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 9a0d36e5
...@@ -444,6 +444,8 @@ static int truemotion1_decode_header(TrueMotion1Context *s) ...@@ -444,6 +444,8 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if (s->flags & FLAG_KEYFRAME) { if (s->flags & FLAG_KEYFRAME) {
/* no change bits specified for a keyframe; only index bytes */ /* no change bits specified for a keyframe; only index bytes */
s->index_stream = s->mb_change_bits; s->index_stream = s->mb_change_bits;
if (s->avctx->width * s->avctx->height / 2048 + header.header_size > s->size)
return AVERROR_INVALIDDATA;
} else { } else {
/* one change bit per 4x4 block */ /* one change bit per 4x4 block */
s->index_stream = s->mb_change_bits + s->index_stream = s->mb_change_bits +
......
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