[FFmpeg-cvslog] twinvqdec: Check the ibps parameter separately

Martin Storsjö git at videolan.org
Thu Jan 16 22:49:48 CET 2014


ffmpeg | branch: release/0.10 | Martin Storsjö <martin at martin.st> | Tue Sep 17 19:33:48 2013 +0300| [591d5281f5bccd2ee398ca46bf7de507be65036b] | committer: Luca Barbato

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 at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit c77d409bf95954aceb762dd800d1ee2868c4b0d4)
(cherry picked from commit 9b9aee27f4e43b4a6b0884f8a6f49eb0289d7c09)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=591d5281f5bccd2ee398ca46bf7de507be65036b
---

 libavcodec/twinvq.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index 22be07a..3006e9f 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;



More information about the ffmpeg-cvslog mailing list