aacdec: check channel count
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Jan 2013 19:37:27 +0000 (20:37 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 27 Jan 2013 19:38:00 +0000 (20:38 +0100)
Prevent out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/aacdec.c

index 235ea46..49e9b60 100644 (file)
@@ -914,6 +914,11 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
         }
     }
 
+    if (avctx->channels > MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     AAC_INIT_VLC_STATIC( 0, 304);
     AAC_INIT_VLC_STATIC( 1, 270);
     AAC_INIT_VLC_STATIC( 2, 550);