Browse code

mace: check channel count, fixes FPE

Fixes ticket1391

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6df1cfa7e4d488051d7b5033c0c69df970db9f82)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/06/03 21:53:43
Showing 1 changed files
... ...
@@ -231,7 +231,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
231 231
 {
232 232
     MACEContext *ctx = avctx->priv_data;
233 233
 
234
-    if (avctx->channels > 2)
234
+    if (avctx->channels > 2 || avctx->channels <= 0)
235 235
         return -1;
236 236
     avctx->sample_fmt = AV_SAMPLE_FMT_S16;
237 237