]> git.sesse.net Git - ffmpeg/commitdiff
avformat/thp: Check fps
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 8 Jun 2020 07:28:55 +0000 (09:28 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 12 Jun 2020 22:43:09 +0000 (00:43 +0200)
Fixes: division by zero
Fixes: 23162/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4856420817436672
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/thp.c

index 4abff1313af7d468759b8fdaa008d1d65ac5ad69..bcc3febaa1967160c233989225d519016f8c6cda 100644 (file)
@@ -75,6 +75,8 @@ static int thp_read_header(AVFormatContext *s)
                            avio_rb32(pb); /* Max samples.  */
 
     thp->fps             = av_d2q(av_int2float(avio_rb32(pb)), INT_MAX);
+    if (thp->fps.den <= 0 || thp->fps.num < 0)
+        return AVERROR_INVALIDDATA;
     thp->framecnt        = avio_rb32(pb);
     thp->first_framesz   = avio_rb32(pb);
     pb->maxsize          = avio_rb32(pb);