Browse Source

imc: Catch a division by zero

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Kostya Shishkov
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.0
Luca Barbato Michael Niedermayer 12 years ago
parent
commit
87fb18c3e4
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavcodec/imc.c

+ 4
- 0
libavcodec/imc.c View File

@@ -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…
Cancel
Save