Commit 4dc93ae3 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/twinvqdec: Correct overflow in block align check

Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int'
Fixes: 19126/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TWINVQ_fuzzer-5687464110325760

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 77ba9e32
...@@ -404,7 +404,7 @@ static av_cold int twinvq_decode_init(AVCodecContext *avctx) ...@@ -404,7 +404,7 @@ static av_cold int twinvq_decode_init(AVCodecContext *avctx)
tctx->frame_size = avctx->bit_rate * tctx->mtab->size tctx->frame_size = avctx->bit_rate * tctx->mtab->size
/ avctx->sample_rate + 8; / avctx->sample_rate + 8;
tctx->is_6kbps = 0; tctx->is_6kbps = 0;
if (avctx->block_align && avctx->block_align * 8 / tctx->frame_size > 1) { if (avctx->block_align && avctx->block_align * 8LL / tctx->frame_size > 1) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"VQF TwinVQ should have only one frame per packet\n"); "VQF TwinVQ should have only one frame per packet\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
......
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