alsdec: Check that quantized parcor coeffs are within range.
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 29 Feb 2012 05:10:17 +0000 (06:10 +0100)
committerJustin Ruggles <justin.ruggles@gmail.com>
Mon, 17 Sep 2012 18:17:27 +0000 (14:17 -0400)
ALS spec:
11.6.3.1.1 Quantization and encoding of parcor coefficients
...
In all cases the resulting quantized values ak are restricted to the range [-64,63].

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
libavcodec/alsdec.c

index defe3c48502f7fd34f9bcc782a058ca7812e2dc7..b4bc41bee1c33ccaff84bd0d73f454a686928323 100644 (file)
@@ -705,6 +705,10 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
                     int rice_param = parcor_rice_table[sconf->coef_table][k][1];
                     int offset     = parcor_rice_table[sconf->coef_table][k][0];
                     quant_cof[k] = decode_rice(gb, rice_param) + offset;
+                    if (quant_cof[k] < -64 || quant_cof[k] > 63) {
+                        av_log(avctx, AV_LOG_ERROR, "quant_cof %d is out of range\n", quant_cof[k]);
+                        return AVERROR_INVALIDDATA;
+                    }
                 }
 
                 // read coefficients 20 to 126