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

Luca Barbato git at videolan.org
Sun Sep 22 13:28:53 CEST 2013


ffmpeg | branch: release/0.10 | Luca Barbato <lu_zero at gentoo.org> | Tue Jul  9 09:18:16 2013 +0200| [90acd3bfe7fa8d4c92712d40e284c15d95ce5005] | 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>

Conflicts:
	libavcodec/imc.c

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

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

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



More information about the ffmpeg-cvslog mailing list