aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-01-19 15:42:47 +0100
committerPaul B Mahol <onemda@gmail.com>2017-01-19 15:42:47 +0100
commit45f4bf94afb8b70d99fb7b5760fd65f5c3ad8b88 (patch)
tree7c6d170a685df6a3114dde13a83840be5d0fcd37
parent0fe50e56e9ca74f9d992b50ee512eadc428410d7 (diff)
downloadffmpeg-45f4bf94afb8b70d99fb7b5760fd65f5c3ad8b88.tar.gz
avcodec/wmaprodec: check number of channels for XMA streams
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/wmaprodec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index b0d3edeb9a..55a48078db 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1825,8 +1825,13 @@ static av_cold int xma_decode_init(AVCodecContext *avctx)
XMADecodeCtx *s = avctx->priv_data;
int i, ret;
- for (i = 0; i < avctx->channels / 2; i++) {
+ if (avctx->channels <= 0 || avctx->channels > 8)
+ return AVERROR_INVALIDDATA;
+
+ for (i = 0; i < (avctx->channels + 1) / 2; i++) {
ret = decode_init(&s->xma[i], avctx);
+ if (ret < 0)
+ return ret;
s->frames[i] = av_frame_alloc();
if (!s->frames[i])
return AVERROR(ENOMEM);