From: Luca Barbato Date: Tue, 9 Jul 2013 07:19:30 +0000 (+0200) Subject: imc: Catch a division by zero X-Git-Tag: android-x86-4.4-r1~2458 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=87fb18c3e4fea70d264c49428a66f86baf048450;p=android-x86%2Fexternal-ffmpeg.git imc: Catch a division by zero Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Reviewed-by: Kostya Shishkov Signed-off-by: Michael Niedermayer --- diff --git a/libavcodec/imc.c b/libavcodec/imc.c index eb7c25524a..deec0a12ba 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -450,6 +450,10 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx, iacc += chctx->bandWidthT[i]; summa += chctx->bandWidthT[i] * chctx->flcoeffs4[i]; } + + if (!iacc) + return AVERROR_INVALIDDATA; + chctx->bandWidthT[BANDS - 1] = 0; summa = (summa * 0.5 - freebits) / iacc;