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:
@@ -365,6 +365,10 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
|
|||||||
iacc += q->bandWidthT[i];
|
iacc += q->bandWidthT[i];
|
||||||
summa += q->bandWidthT[i] * q->flcoeffs4[i];
|
summa += q->bandWidthT[i] * q->flcoeffs4[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!iacc)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
q->bandWidthT[BANDS-1] = 0;
|
q->bandWidthT[BANDS-1] = 0;
|
||||||
summa = (summa * 0.5 - freebits) / iacc;
|
summa = (summa * 0.5 - freebits) / iacc;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user