Commit 7faa40af authored by Andreas Cadhalpun's avatar Andreas Cadhalpun Committed by Michael Niedermayer

avformat/adxdec: check avctx->channels for invalid values

This avoids a null pointer dereference of pkt->data.
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 64ea4a05
...@@ -40,6 +40,11 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -40,6 +40,11 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecContext *avctx = s->streams[0]->codec; AVCodecContext *avctx = s->streams[0]->codec;
int ret, size; 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; size = BLOCK_SIZE * avctx->channels;
pkt->pos = avio_tell(s->pb); pkt->pos = avio_tell(s->pb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment