[FFmpeg-cvslog] imc: Catch a division by zero

Luca Barbato git at videolan.org
Tue Jul 9 16:26:57 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Jul  9 09:19:30 2013 +0200| [87fb18c3e4fea70d264c49428a66f86baf048450] | committer: Michael Niedermayer

imc: Catch a division by zero

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Kostya Shishkov
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87fb18c3e4fea70d264c49428a66f86baf048450
---

 libavcodec/imc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index eb7c255..deec0a1 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -450,6 +450,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;
 



More information about the ffmpeg-cvslog mailing list