]> git.sesse.net Git - ffmpeg/commitdiff
avformat/matroskadec: Check for EOF in resync loop
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 29 Jan 2021 20:18:36 +0000 (21:18 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 15 Mar 2021 21:24:31 +0000 (22:24 +0100)
Fixes: Timeout (too long -> instantly)
Fixes: 29136/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4586141227548672
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/matroskadec.c

index 25eca5825e541fc877a019a316d0b35340df1160..fa5f3d9c02630e79191323551c34508c921a8126 100644 (file)
@@ -2953,6 +2953,8 @@ static int matroska_read_header(AVFormatContext *s)
             goto fail;
         pos = avio_tell(matroska->ctx->pb);
         res = ebml_parse(matroska, matroska_segment, matroska);
+        if (res == AVERROR(EIO)) // EOF is translated to EIO, this exists the loop on EOF
+            goto fail;
     }
     /* Set data_offset as it might be needed later by seek_frame_generic. */
     if (matroska->current_id == MATROSKA_ID_CLUSTER)