diff mbox series

[FFmpeg-devel,3/5] avformat/soxdec: Check channels to be positive

Message ID 20210117225311.17297-3-michael@niedermayer.cc
State Accepted
Commit b0588b73daeb0e6a0741f39b33943c67eac71619
Headers show
Series [FFmpeg-devel,1/5] avformat/sccdec: Use larger intermediate for ts/next_ts computation
Related show

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 Jan. 17, 2021, 10:53 p.m. UTC
Fixes: signed integer overflow: 32 * -1795162112 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SOX_fuzzer-6724151473340416

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

Patch

diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index d3f709f9a6..35e11feec6 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -90,7 +90,7 @@  static int sox_read_header(AVFormatContext *s)
                sample_rate_frac);
 
     if ((header_size + 4) & 7 || header_size < SOX_FIXED_HDR + comment_size
-        || st->codecpar->channels > 65535) /* Reserve top 16 bits */ {
+        || st->codecpar->channels > 65535 || st->codecpar->channels <= 0) /* Reserve top 16 bits */ {
         av_log(s, AV_LOG_ERROR, "invalid header\n");
         return AVERROR_INVALIDDATA;
     }