aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-07-09 09:18:16 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-09-13 15:49:23 +0200
commit90acd3bfe7fa8d4c92712d40e284c15d95ce5005 (patch)
treeb2fe43f6d05f02883be1c59e7e161f31850edcec
parent40ee4de6a6a9f7af3b5bb8a690aa1cae0a752430 (diff)
downloadffmpeg-90acd3bfe7fa8d4c92712d40e284c15d95ce5005.tar.gz
imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org (cherry picked from commit bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> Conflicts: libavcodec/imc.c
-rw-r--r--libavcodec/imc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index ff8e31e9e6..bee38b07f8 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -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;