[FFmpeg-cvslog] avformat/wtvdec: Check for EOF before seeking back in parse_media_type()

Michael Niedermayer git at videolan.org
Wed Sep 8 22:43:50 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Aug  1 20:42:53 2021 +0200| [88264f84c99519651a7417f4eed25ae17a6e61d1] | committer: Michael Niedermayer

avformat/wtvdec: Check for EOF before seeking back in parse_media_type()

Fixes: Infinite loop
Fixes: 36311/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-4889181296918528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 89505d38de989bddd579ce3b841f1c011f1d7bf2)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88264f84c99519651a7417f4eed25ae17a6e61d1
---

 libavformat/wtvdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 876256676c..1d5ba03bef 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -660,6 +660,8 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
         avio_skip(pb, size - 32);
         ff_get_guid(pb, &actual_subtype);
         ff_get_guid(pb, &actual_formattype);
+        if (avio_feof(pb))
+            return NULL;
         avio_seek(pb, -size, SEEK_CUR);
 
         st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32);



More information about the ffmpeg-cvslog mailing list