aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-17 23:16:46 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:22 +0100
commit9c6a0fa8f10e65e8ea0d58f088b830b2239f7a9d (patch)
treeb543516d943562d547bdad17f91f3770fe2599b8
parenta296ecaa71be186f2001a1cb156b9bc5f9d28e23 (diff)
downloadffmpeg-9c6a0fa8f10e65e8ea0d58f088b830b2239f7a9d.tar.gz
avformat/wavdec: Check block_align vs. channels before combining them
Fixes: signed integer overflow: 65535 * 65312 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6606935226974208 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 0af0a80cef0eae709b727896e92b44382c3feca8) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/wavdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index dec41d545b..703a98414d 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -589,7 +589,8 @@ break_loop:
} else if (st->codecpar->codec_id == AV_CODEC_ID_XMA1 ||
st->codecpar->codec_id == AV_CODEC_ID_XMA2) {
st->codecpar->block_align = 2048;
- } else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2) {
+ } else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2 &&
+ st->codecpar->block_align < INT_MAX / st->codecpar->channels) {
st->codecpar->block_align *= st->codecpar->channels;
}