aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-17 19:33:48 +0300
committerLuca Barbato <lu_zero@gentoo.org>2013-10-04 04:45:24 +0200
commit9b9aee27f4e43b4a6b0884f8a6f49eb0289d7c09 (patch)
treee88a7d6af0e44ed738c6e58d969120aea6f688a9
parentfc4d11ec9b4c9710e2dac012d4ed0e7d08c6df7d (diff)
downloadffmpeg-9b9aee27f4e43b4a6b0884f8a6f49eb0289d7c09.tar.gz
twinvqdec: Check the ibps parameter separately
This is required, since invalid parameters actually could pass the switch check below. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit c77d409bf95954aceb762dd800d1ee2868c4b0d4)
-rw-r--r--libavcodec/twinvq.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index 8989469237..f6c897f899 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -1142,6 +1142,10 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
AV_CH_LAYOUT_STEREO;
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;