summaryrefslogtreecommitdiff
path: root/libavformat/adxdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/adxdec.c')
-rw-r--r--libavformat/adxdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index fc83ff263b..9d3ebe398b 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;