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

Luca Barbato git at videolan.org
Tue Aug 27 16:51:18 CEST 2013


ffmpeg | branch: release/1.1 | Luca Barbato <lu_zero at gentoo.org> | Tue Jul  9 09:18:16 2013 +0200| [6d2a92c4678616fe342be0b606343ae3ade83641] | committer: Luca Barbato

imc: Catch a division by zero

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7)

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

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

diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 5cff70f..316dd77 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