summaryrefslogtreecommitdiff
path: root/libavcodec/wavpack.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-05-27 19:11:09 +0200
committerAnton Khirnov <anton@khirnov.net>2013-05-28 17:47:17 +0200
commiteae1b8451a4d606dd457736ce7240ee12535fb36 (patch)
tree8589decc5d94e9d31e606f9f1d6f92fbcd6b6b79 /libavcodec/wavpack.c
parent7d039e70a5ff23a7deaa866684d2e8872acc5169 (diff)
wavpack: check that there aren't too many blocks per packet
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r--libavcodec/wavpack.c5
1 files changed, 5 insertions, 0 deletions
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];