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>

Conflicts:
	libavcodec/imc.c
This commit is contained in:
Luca Barbato
2013-07-09 09:18:16 +02:00
parent 40ee4de6a6
commit 90acd3bfe7

View File

@@ -365,6 +365,10 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
iacc += q->bandWidthT[i];
summa += q->bandWidthT[i] * q->flcoeffs4[i];
}
if (!iacc)
return AVERROR_INVALIDDATA;
q->bandWidthT[BANDS-1] = 0;
summa = (summa * 0.5 - freebits) / iacc;