alac: check channel count more completely, fix out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-13 22:07:39 +01:00
parent b119133136
commit 001af703c6
1 changed files with 1 additions and 1 deletions

View 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;