Commit 06f6857b authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/vmdaudio: Check block_align more

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d31a1266
...@@ -76,7 +76,9 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) ...@@ -76,7 +76,9 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (avctx->block_align < 1 || avctx->block_align % avctx->channels) { if (avctx->block_align < 1 || avctx->block_align % avctx->channels ||
avctx->block_align > INT_MAX - avctx->channels
) {
av_log(avctx, AV_LOG_ERROR, "invalid block align\n"); av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment