diff mbox series

[FFmpeg-devel,2/2] avformat/3dostr: Check sample_rate

Message ID 20210208132902.6602-2-michael@niedermayer.cc
State Accepted
Commit 7e5034f97e41d3f8112c1f8da3b5274ab99ef6f8
Headers show
Series [FFmpeg-devel,1/2] avformat/wtvdec: Check len in parse_chunks() to avoid overflow | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Feb. 8, 2021, 1:29 p.m. UTC
Fixes: signed integer overflow: -1268324762623155200 * 8 cannot be represented in type 'long'
Fixes: 30123/clusterfuzz-testcase-minimized-ffmpeg_dem_THREEDOSTR_fuzzer-6710765123928064

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/3dostr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Feb. 8, 2021, 1:46 p.m. UTC | #1
lgtm
diff mbox series

Patch

diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c
index 2a35d661c3..534f205fc4 100644
--- a/libavformat/3dostr.c
+++ b/libavformat/3dostr.c
@@ -103,7 +103,7 @@  static int threedostr_read_header(AVFormatContext *s)
             st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
             st->codecpar->sample_rate = avio_rb32(s->pb);
             st->codecpar->channels    = avio_rb32(s->pb);
-            if (st->codecpar->channels <= 0)
+            if (st->codecpar->channels <= 0 || st->codecpar->sample_rate <= 0)
                 return AVERROR_INVALIDDATA;
             codec                  = avio_rl32(s->pb);
             avio_skip(s->pb, 4);