aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/imc.c
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-07-09 10:49:29 +0200
commitbbf6a4aa20bfe3d7869b2218e66063602dfb8aa7 (patch)
tree246c0839aea5ee4b6b8053b6c50603f893145831 /libavcodec/imc.c
parent50cf5a7fb78846fc39b3ecdaa896a10bcd74da2a (diff)
downloadffmpeg-bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7.tar.gz
imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to '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 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;