Fix js_vlc_bits value validation when joint stereo is used in cook decoder.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 17 Sep 2011 14:56:35 +0000 (16:56 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 21 Sep 2011 17:50:08 +0000 (19:50 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 352c878de6fca57a3f2a6369e27ca442fa5f9518)

libavcodec/cook.c

index 116be2f..192ec5b 100644 (file)
@@ -1175,8 +1175,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;
         }