]> git.sesse.net Git - ffmpeg/commitdiff
avformat/moflex: Check m->size before seeking
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 2 Oct 2020 12:59:15 +0000 (14:59 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 4 Oct 2020 14:54:11 +0000 (16:54 +0200)
Fixes: Infinite loop
Fixes: 26016/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6195663833137152
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/moflex.c

index 937f63cb6374ed060c71beb0cb46740acb693142..a24e12eb8ec555523f08192321156c437f99f1fb 100644 (file)
@@ -342,8 +342,11 @@ static int moflex_read_packet(AVFormatContext *s, AVPacket *pkt)
 
         m->in_block = 0;
 
-        if (m->flags % 2 == 0)
+        if (m->flags % 2 == 0) {
+            if (m->size <= 0)
+                return AVERROR_INVALIDDATA;
             avio_seek(pb, m->pos + m->size, SEEK_SET);
+        }
     }
 
     return AVERROR_EOF;