aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/wvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-09-20 20:53:31 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:37:20 +0200
commitb81d1379c296de48ebcc7ead0b3f22a4265b0ea1 (patch)
tree96749c0aae719097a0f91cfa3f818ace1d8f8f93 /libavformat/wvdec.c
parentf4d75810b4575a35fd02ede8137f4bb3e8488aba (diff)
downloadffmpeg-b81d1379c296de48ebcc7ead0b3f22a4265b0ea1.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>
Diffstat (limited to 'libavformat/wvdec.c')
-rw-r--r--libavformat/wvdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c
index 2060523c3b..8ddebf8033 100644
--- a/libavformat/wvdec.c
+++ b/libavformat/wvdec.c
@@ -81,6 +81,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb)
int ret;
int rate, bpp, chan;
uint32_t chmask, flags;
+ unsigned rate_x;
wc->pos = avio_tell(pb);
@@ -179,7 +180,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;