diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-07-09 09:19:30 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-09 16:20:50 +0200 |
commit | 87fb18c3e4fea70d264c49428a66f86baf048450 (patch) | |
tree | 5bd594fc3152042127189447d1b94306242c7c77 /libavcodec/imc.c | |
parent | 7d9cb126893d56ea7b4e1cf4715a7c5e6dc66ad6 (diff) | |
download | ffmpeg-87fb18c3e4fea70d264c49428a66f86baf048450.tar.gz |
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>
Diffstat (limited to 'libavcodec/imc.c')
-rw-r--r-- | libavcodec/imc.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |