alac: reject rice_limit 0 if compression is used
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 23 Apr 2015 22:01:43 +0000 (00:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 21 May 2015 18:43:37 +0000 (20:43 +0200)
If rice_limit is 0, k can be 0 in decode_scalar, which calls show_bits(gb, k).

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4b657a1b1eedcf38bcf36e89a2f4be6f76b5ce09)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/alac.c

index aec7bb4..f5a5b86 100644 (file)
@@ -316,6 +316,11 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
         int lpc_quant[2];
         int rice_history_mult[2];
 
+        if (!alac->rice_limit) {
+            avpriv_request_sample(alac->avctx, "Compression with rice limit 0");
+            return AVERROR(ENOSYS);
+        }
+
         decorr_shift       = get_bits(&alac->gb, 8);
         decorr_left_weight = get_bits(&alac->gb, 8);