[FFmpeg-cvslog] avutil/mathematics: Fix division by 0

Michael Niedermayer git at videolan.org
Wed Dec 9 17:53:18 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Dec  9 17:39:38 2015 +0100| [bc8b1e694cc395fdf5e2917377ef11263c937d85] | committer: Michael Niedermayer

avutil/mathematics: Fix division by 0

Fixes: CID1341571

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavutil/mathematics.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index c12c73e..20ff37f 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -85,7 +85,7 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
         else {
             int64_t ad = a / c;
             int64_t a2 = (a % c * b + r) / c;
-            if (ad >= INT32_MAX && ad > (INT64_MAX - a2) / b)
+            if (ad >= INT32_MAX && b && ad > (INT64_MAX - a2) / b)
                 return INT64_MIN;
             return ad * b + a2;
         }



More information about the ffmpeg-cvslog mailing list