summaryrefslogtreecommitdiff
path: root/libavformat/thp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-06-08 09:28:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-06-13 00:43:09 +0200
commit0e15b01b4e463d12128db2c15de7741637548347 (patch)
tree16610958d5a57efcfd7e30a48987fc7872755be7 /libavformat/thp.c
parent9a42a67c5ca198a3879b7f3663cc44ccbcaf0bd3 (diff)
avformat/thp: Check fps
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>
Diffstat (limited to 'libavformat/thp.c')
-rw-r--r--libavformat/thp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 4abff1313a..bcc3febaa1 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -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);