mace: check channel count, fixes FPE
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 3 Jun 2012 12:53:43 +0000 (14:53 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 3 Jun 2012 13:01:34 +0000 (15:01 +0200)
Fixes ticket1391

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mace.c

index bf9ea08..dd721d2 100644 (file)
@@ -231,7 +231,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
 {
     MACEContext *ctx = avctx->priv_data;
 
-    if (avctx->channels > 2)
+    if (avctx->channels > 2 || avctx->channels <= 0)
         return -1;
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;