alac: check channel count more completely, fix out of array read
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Nov 2012 21:07:39 +0000 (22:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Nov 2012 21:08:09 +0000 (22:08 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/alac.c

index b705343..49ccaac 100644 (file)
@@ -638,7 +638,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
         else
             avctx->channels = alac->channels;
     }
-    if (avctx->channels > MAX_CHANNELS) {
+    if (avctx->channels > MAX_CHANNELS || avctx->channels <= 0 ) {
         av_log(avctx, AV_LOG_ERROR, "Unsupported channel count: %d\n",
                avctx->channels);
         return AVERROR_PATCHWELCOME;