From: Luca Barbato Date: Tue, 9 Jul 2013 07:18:16 +0000 (+0200) Subject: imc: Catch a division by zero X-Git-Tag: v10_alpha1~1193 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7;p=platform%2Fupstream%2Flibav.git imc: Catch a division by zero Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org --- diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 2749099..e3f5e15 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -449,6 +449,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;