cook: Fix js_vlc_bits value validation for joint stereo
authorLaurent Aimar <fenrir@videolan.org>
Sat, 17 Sep 2011 14:56:35 +0000 (16:56 +0200)
committerJanne Grunau <janne-libav@jannau.net>
Thu, 6 Oct 2011 21:31:06 +0000 (23:31 +0200)
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
libavcodec/cook.c

index b5492db..13f2dd6 100644 (file)
@@ -1174,8 +1174,9 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
             return -1;
         }
 
-        if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 0)) {
-            av_log(avctx,AV_LOG_ERROR,"js_vlc_bits = %d, only >= 0 and <= 6 allowed!\n",q->subpacket[s].js_vlc_bits);
+        if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 2*q->subpacket[s].joint_stereo)) {
+            av_log(avctx,AV_LOG_ERROR,"js_vlc_bits = %d, only >= %d and <= 6 allowed!\n",
+                   q->subpacket[s].js_vlc_bits, 2*q->subpacket[s].joint_stereo);
             return -1;
         }