From: Michael Niedermayer <[email protected]>

This fixes crashes with invalid files.

Based on patch by Piotr Bandurski.
---
 libavcodec/wmadec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index a730059..4fdfe74 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -102,6 +102,11 @@ static int wma_decode_init(AVCodecContext * avctx)
     s->use_bit_reservoir = flags2 & 0x0002;
     s->use_variable_block_len = flags2 & 0x0004;
 
+    if (avctx->channels > MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid number of channels (%d)\n", 
avctx->channels);
+        return AVERROR(EINVAL);
+    }
+
     if(ff_wma_init(avctx, flags2)<0)
         return -1;
 
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to