On 09.06.2015 22:30, Michael Niedermayer wrote:
> On Tue, Jun 09, 2015 at 10:22:05PM +0200, Andreas Cadhalpun wrote:
>> avctx->channels can be 0, causing SIGFPE crashes.
>>
>> Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
>> ---
>>  libavcodec/sonic.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> i think avctx->channels should be set, channels is only set during
> init and cannot change per frame in sonic
> maybe avctx->channels could be set during init

Yes, that's way better, because it actually allows decoding such samples.
New patch attached.

Best regards,
Andreas

>From 489bc2758317c5534ae1292c3f772e0dc870d0e4 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Tue, 9 Jun 2015 22:41:24 +0200
Subject: [PATCH] sonic: set avctx->channels in sonic_decode_init

Otherwise it can be 0 in sonic_decode_frame causing SIGFPE crashes.
---
 libavcodec/sonic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 3db77f3..c5076f9 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -900,6 +900,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
         return AVERROR_INVALIDDATA;
     }
+    avctx->channels = s->channels;
 
     s->lossless = get_bits1(&gb);
     if (!s->lossless)
-- 
2.1.4

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

Reply via email to