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

Luca Barbato git at videolan.org
Wed Jul 10 12:36:27 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Jul  9 09:18:16 2013 +0200| [bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7] | committer: Luca Barbato

imc: Catch a division by zero

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

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

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

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 2749099..e3f5e15 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;
 



More information about the ffmpeg-cvslog mailing list