diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-09-20 20:53:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-02-02 14:18:20 +0100 |
commit | e3508f371ecfb1afb99314d4a7621186cd84ce24 (patch) | |
tree | 619ecbdb487ed1272afe1072a0927d25b4bc4162 | |
parent | d0cb1eb92575297edb0937c8c4855e98f43d5222 (diff) | |
download | ffmpeg-e3508f371ecfb1afb99314d4a7621186cd84ce24.tar.gz |
avformat/wvdec: Check rate for overflow
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@niedermayer.cc>
(cherry picked from commit 688c1175ba91d0477cc461e5bfda210d6659a3b8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/wvdec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c index b9fc6a59f9..7a5997c1ee 100644 --- a/libavformat/wvdec.c +++ b/libavformat/wvdec.c @@ -79,8 +79,9 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb) { WVContext *wc = ctx->priv_data; int ret; - int rate, rate_x, bpp, chan; + int rate, bpp, chan; uint32_t chmask, flags; + unsigned rate_x; wc->pos = avio_tell(pb); @@ -192,7 +193,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; |