1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

twinvq: check bitrate for validity avoid division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-09 18:45:41 +01:00
parent e481ba2ed7
commit b8dc5f8bb3

View File

@ -1142,6 +1142,11 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
ibps = avctx->bit_rate / (1000 * avctx->channels); ibps = avctx->bit_rate / (1000 * avctx->channels);
if (ibps > 255) {
av_log(avctx, AV_LOG_ERROR, "unsupported per channel bitrate %dkbps\n", ibps);
return AVERROR_INVALIDDATA;
}
switch ((isampf << 8) + ibps) { switch ((isampf << 8) + ibps) {
case (8 <<8) + 8: tctx->mtab = &mode_08_08; break; case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;
case (11<<8) + 8: tctx->mtab = &mode_11_08; break; case (11<<8) + 8: tctx->mtab = &mode_11_08; break;