aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-08 17:28:27 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:44 +0100
commit600e1df9a58cb19c184c97189bce103ce8eb1124 (patch)
treefc6d738c7cef91c224622e427b42b2ff4f8fcbf0
parent3b8512ae09f7552fce1d7896af8d52ce36be8520 (diff)
downloadffmpeg-600e1df9a58cb19c184c97189bce103ce8eb1124.tar.gz
avcodec/vmdaudio: Check chunk counts to avoid integer overflow
Fixes: signed integer overflow: 4 * 538976288 cannot be represented in type 'int' Fixes: 18622/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5092166174507008 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 47d963335eb2c36c0e6615d7971c762458e813dd) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vmdaudio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/vmdaudio.c b/libavcodec/vmdaudio.c
index e8c8a064c7..c7826fa3ce 100644
--- a/libavcodec/vmdaudio.c
+++ b/libavcodec/vmdaudio.c
@@ -179,6 +179,9 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
/* drop incomplete chunks */
buf_size = audio_chunks * s->chunk_size;
+ if (silent_chunks + audio_chunks >= INT_MAX / avctx->block_align)
+ return AVERROR_INVALIDDATA;
+
/* get output buffer */
frame->nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) /
avctx->channels;