diff mbox

[FFmpeg-devel,1/2] avcodec/truemotion2: Check len in tm2_read_stream()

Message ID 20180702001045.29491-1-michael@niedermayer.cc
State Accepted
Commit 4423085ca5009cd4c713798ce34fa3daeee0f27d
Headers show

Commit Message

Michael Niedermayer July 2, 2018, 12:10 a.m. UTC
Fixes: Timeout
Fixes: 8774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5942199639343104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
---
 libavcodec/truemotion2.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer July 4, 2018, 10:15 a.m. UTC | #1
On Mon, Jul 02, 2018 at 02:10:44AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 8774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5942199639343104
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> ---
>  libavcodec/truemotion2.c | 4 ++++
>  1 file changed, 4 insertions(+)

will apply patchset

[...]
diff mbox

Patch

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index b689efdb99..58a577f53c 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -377,6 +377,10 @@  static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i
             }
         }
     } else {
+        if (len < 0) {
+            ret = AVERROR_INVALIDDATA;
+            goto end;
+        }
         for (i = 0; i < toks; i++) {
             ctx->tokens[stream_id][i] = codes.recode[0];
             if (stream_id <= TM2_MOT && ctx->tokens[stream_id][i] >= TM2_DELTAS) {