On 23.04.2015 23:37, Michael Niedermayer wrote:
> On Thu, Apr 23, 2015 at 08:53:29PM +0200, Andreas Cadhalpun wrote:
>> On 23.04.2015 16:37, Michael Niedermayer wrote:
>>> On Wed, Apr 22, 2015 at 06:24:54PM +0200, Andreas Cadhalpun wrote:
>>  libavcodec/alac.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/libavcodec/alac.c b/libavcodec/alac.c
>> index ffd2d77..16d56a7 100644
>> --- a/libavcodec/alac.c
>> +++ b/libavcodec/alac.c
>> @@ -569,6 +569,10 @@ static int alac_set_info(ALACContext *alac)
>>      alac->rice_history_mult    = bytestream2_get_byteu(&gb);
>>      alac->rice_initial_history = bytestream2_get_byteu(&gb);
>>      alac->rice_limit           = bytestream2_get_byteu(&gb);
>> +    if (!alac->rice_limit) {
>> +        avpriv_request_sample(alac->avctx, "Rice limit 0");
>> +        return AVERROR(ENOSYS);
>> +    }
> 
> this doesnt work as our encoder uses a rice_limit of 0 when
> compression is disabled

I see.

> moving the check into if(is_compressed) should work hopefully

Done.

Best regards,
Andreas

>From 709c9f553387989633e4cb7416851c538884fdb0 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Fri, 24 Apr 2015 00:01:43 +0200
Subject: [PATCH] alac: reject rice_limit 0 if compression is used

If rice_limit is 0, k can be 0 in decode_scalar, which calls show_bits(gb, k).

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavcodec/alac.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index ffd2d77..ada7c73 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -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);
 
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to