diff mbox series

[FFmpeg-devel,1/4] avformat/thp: Check fps

Message ID 20200608101451.10928-1-michael@niedermayer.cc
State Accepted
Commit 0e15b01b4e463d12128db2c15de7741637548347
Headers show
Series [FFmpeg-devel,1/4] avformat/thp: Check fps | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer June 8, 2020, 10:14 a.m. UTC
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 | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer June 12, 2020, 9:43 p.m. UTC | #1
On Mon, Jun 08, 2020 at 12:14:48PM +0200, Michael Niedermayer wrote:
> 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 | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

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);