]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/dsicinvideo: Fail if there is only a small fraction of the data available...
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 16 Apr 2018 20:29:09 +0000 (22:29 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 19 Apr 2018 20:59:40 +0000 (22:59 +0200)
Fixes: Timeout
Fixes: 6306/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-5079253549842432
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dsicinvideo.c

index add7afa383170f808e29d0d6fa22c1544ab6a1bb..aa080417d25f118e4bedd25504680b4f683d583d 100644 (file)
@@ -158,6 +158,9 @@ static int cin_decode_lzss(const unsigned char *src, int src_size,
         }
     }
 
+    if (dst_end - dst > dst_size - dst_size/10)
+        return AVERROR_INVALIDDATA;
+
     return 0;
 }
 
@@ -184,6 +187,10 @@ static int cin_decode_rle(const unsigned char *src, int src_size,
         }
         dst += len;
     }
+
+    if (dst_end - dst > dst_size - dst_size/10)
+        return AVERROR_INVALIDDATA;
+
     return 0;
 }