From bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 9 Jul 2013 09:18:16 +0200 Subject: imc: Catch a division by zero Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org --- libavcodec/imc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libavcodec/imc.c') diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 2749099d22..e3f5e15324 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; -- cgit v1.2.3