diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 22be07a5b5..3006e9f108 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -1137,6 +1137,10 @@ static av_cold int twin_decode_init(AVCodecContext *avctx) return -1; } ibps = avctx->bit_rate / (1000 * avctx->channels); + if (ibps < 8 || ibps > 48) { + av_log(avctx, AV_LOG_ERROR, "Bad bitrate per channel value %d\n", ibps); + return AVERROR_INVALIDDATA; + } switch ((isampf << 8) + ibps) { case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;