imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bbf6a4aa20)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
aa99cb15f6
commit
6d2a92c467
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue