avcodec/truemotion2: Fix passing null pointer to memset()
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 28 May 2017 19:54:02 +0000 (21:54 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 28 May 2017 19:56:02 +0000 (21:56 +0200)
Fixes part of: 1888/clusterfuzz-testcase-minimized-5237704826552320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/truemotion2.c

index 4f0e52d..e6ae05f 100644 (file)
@@ -915,7 +915,8 @@ static int decode_frame(AVCodecContext *avctx,
                             buf_size - offset);
         if (t < 0) {
             int j = tm2_stream_order[i];
-            memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
+            if (l->tok_lens[j])
+                memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
             return t;
         }
         offset += t;