sonic: set avctx->channels in sonic_decode_init
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 9 Jun 2015 20:41:24 +0000 (22:41 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 9 Jun 2015 21:21:51 +0000 (23:21 +0200)
Otherwise it can be 0 in sonic_decode_frame, causing SIGFPE crashes.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/sonic.c

index 3db77f30a390f97f8a98f741010a4863fd956f86..c5076f9d8ebf55278eca619f7e2ea98fdf67713b 100644 (file)
@@ -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)