[FFmpeg-cvslog] adxdec: set avctx->channels in adx_read_header

Andreas Cadhalpun git at videolan.org
Mon Mar 9 01:50:23 CET 2015


ffmpeg | branch: release/2.4 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Thu Feb 26 01:06:57 2015 +0100| [a73b2c288e3dace6e054a5b48640978be1d5df84] | committer: Vittorio Giovara

adxdec: set avctx->channels in adx_read_header

It is used in adx_read_packet, which currently depends on the
decoder/parser setting this value between reading the file header and
demuxing the first packet.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a73b2c288e3dace6e054a5b48640978be1d5df84
---

 libavformat/adxdec.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index fc83ff2..9d3ebe3 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -89,8 +89,14 @@ static int adx_read_header(AVFormatContext *s)
         av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n");
         return AVERROR_INVALIDDATA;
     }
+    avctx->channels    = AV_RB8(avctx->extradata + 7);
     avctx->sample_rate = AV_RB32(avctx->extradata + 8);
 
+    if (avctx->channels <= 0) {
+        av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", avctx->channels);
+        return AVERROR_INVALIDDATA;
+    }
+
     st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id    = s->iformat->raw_codec_id;
 



More information about the ffmpeg-cvslog mailing list