summaryrefslogtreecommitdiff
path: root/libavcodec/twinvq.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-09 18:45:41 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-09 18:46:17 +0100
commitb8dc5f8bb3b14bfd2289a0444c7b706299555d97 (patch)
treee5959fe6ff3f7ea094e262fd370e6f94c26b90c9 /libavcodec/twinvq.c
parente481ba2ed79421d82ed631d187c05c03260c6561 (diff)
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>
Diffstat (limited to 'libavcodec/twinvq.c')
-rw-r--r--libavcodec/twinvq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index f4eba4d906..7281d9cd2d 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -1142,6 +1142,11 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
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) {
case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;
case (11<<8) + 8: tctx->mtab = &mode_11_08; break;