From eae1b8451a4d606dd457736ce7240ee12535fb36 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 27 May 2013 19:11:09 +0200 Subject: wavpack: check that there aren't too many blocks per packet --- libavcodec/wavpack.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libavcodec/wavpack.c') diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 9c766ca181..7a14519bf9 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1120,6 +1120,11 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, } } + if (wc->ch_offset + s->stereo >= avctx->channels) { + av_log(avctx, AV_LOG_WARNING, "Too many channels coded in a packet.\n"); + return (avctx->err_recognition & AV_EF_EXPLODE) ? AVERROR_INVALIDDATA : 0; + } + samples_l = frame->extended_data[wc->ch_offset]; if (s->stereo) samples_r = frame->extended_data[wc->ch_offset + 1]; -- cgit v1.2.3