aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-02-25 22:55:44 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-14 14:27:23 +0100
commit3193f4d3f2a6ad982d4fdbb4dc226ea8d81572b7 (patch)
treee3f9031367e2a6b08c716a1c05155bf48ca6df13
parent265ad094a8cbf071f24a32370a7ed3e2e7539e5a (diff)
downloadffmpeg-3193f4d3f2a6ad982d4fdbb4dc226ea8d81572b7.tar.gz
avformat/adxdec: check avctx->channels for invalid values
This avoids a null pointer dereference of pkt->data. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 7faa40af982960608b117e20fec999b48011e5e0) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/adxdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index fe22c3ae69..b577b89cb9 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -41,6 +41,11 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecContext *avctx = s->streams[0]->codec;
int ret, size;
+ if (avctx->channels <= 0) {
+ av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", avctx->channels);
+ return AVERROR_INVALIDDATA;
+ }
+
size = BLOCK_SIZE * avctx->channels;
pkt->pos = avio_tell(s->pb);