[FFmpeg-devel] [PATCH] sonic: use s->channels instead of avctx->channels

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Jun 9 22:22:05 CEST 2015


avctx->channels can be 0, causing SIGFPE crashes.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/sonic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 3db77f3..459857d 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -991,7 +991,7 @@ static int sonic_decode_frame(AVCodecContext *avctx,
 
     if (buf_size == 0) return 0;
 
-    frame->nb_samples = s->frame_size / avctx->channels;
+    frame->nb_samples = s->frame_size / s->channels;
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;
     samples = (int16_t *)frame->data[0];
-- 
2.1.4


More information about the ffmpeg-devel mailing list