aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-24 01:43:35 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-31 19:51:56 +0100
commit7bd58702f95abc2a9dea05f1a35eefe2a5613e8b (patch)
tree63a052f67dde80fc20a3dd987c9320acf68f4fff
parent71f3bb58dfd398b65a7c9399d6fc05388aa517be (diff)
downloadffmpeg-7bd58702f95abc2a9dea05f1a35eefe2a5613e8b.tar.gz
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/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4a660fac9899191d4121cde02f2a98977b1303b6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/truemotion1.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index e1824384c5..602de99f10 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -444,6 +444,8 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if (s->flags & FLAG_KEYFRAME) {
/* no change bits specified for a keyframe; only index bytes */
s->index_stream = s->mb_change_bits;
+ if (s->avctx->width * s->avctx->height / 2048 + header.header_size > s->size)
+ return AVERROR_INVALIDDATA;
} else {
/* one change bit per 4x4 block */
s->index_stream = s->mb_change_bits +