[FFmpeg-devel] [PATCH 1/4] avformat/wvdec: Check rate for overflow

Michael Niedermayer michael at niedermayer.cc
Sun Sep 20 23:26:05 EEST 2020


Fixes: signed integer overflow: 6000 * -2147483648 cannot be represented in type 'int'
Fixes: 25700/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6578316302352384

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

diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c
index b9fc6a59f9..b7d8dbbe78 100644
--- a/libavformat/wvdec.c
+++ b/libavformat/wvdec.c
@@ -192,7 +192,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb)
             if (id & 0x40)
                 avio_skip(pb, 1);
         }
-        if (rate == -1) {
+        if (rate == -1 || rate * (uint64_t)rate_x >= INT_MAX) {
             av_log(ctx, AV_LOG_ERROR,
                    "Cannot determine custom sampling rate\n");
             return AVERROR_INVALIDDATA;
-- 
2.17.1



More information about the ffmpeg-devel mailing list