diff mbox

[FFmpeg-devel,2/3] avcodec/truemotion1: Check that the input has enough space for a minimal index_stream

Message ID 20190923234336.30773-2-michael@niedermayer.cc
State Accepted
Commit 4a660fac9899191d4121cde02f2a98977b1303b6
Headers show

Commit Message

Michael Niedermayer Sept. 23, 2019, 11:43 p.m. UTC
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>
---
 libavcodec/truemotion1.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Oct. 8, 2019, 12:53 p.m. UTC | #1
On Tue, Sep 24, 2019 at 01:43:35AM +0200, Michael Niedermayer wrote:
> 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>
> ---
>  libavcodec/truemotion1.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index bcfe473852..b6481cbd7c 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 +