avformat/vividas: Add EOF check in val_1 loop in track_header()
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 29 Oct 2019 21:17:45 +0000 (22:17 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 20 Nov 2019 14:50:15 +0000 (15:50 +0100)
Fixes: Timeout (148sec -> 0.1sec)
Fixes: 18427/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5682124627116032

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

index ab39478..a55f5c0 100644 (file)
@@ -295,6 +295,8 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s,  uint8_t *
     for (i=0;i<val_1;i++) {
         int c = avio_r8(pb);
         for (j=0;j<c;j++) {
+            if (avio_feof(pb))
+                return AVERROR_EOF;
             avio_r8(pb); // val_3
             avio_r8(pb); // val_4
         }