wma: Check channel number before init.
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 16 Nov 2011 02:31:25 +0000 (03:31 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 21 Nov 2011 20:59:17 +0000 (21:59 +0100)
Fixes Ticket240

Based on patch by ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 20431a9982b9bd2c475042d919890a941ad70c71)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wmadec.c

index e7936ce..088d510 100644 (file)
@@ -105,6 +105,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 -1;
+    }
+
     if(ff_wma_init(avctx, flags2)<0)
         return -1;