[poppler] poppler/GfxState.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue May 22 18:08:18 UTC 2018


 poppler/GfxState.cc |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 3b8634e744aa5ba3b317fd3378ba07a438826827
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue May 22 20:07:50 2018 +0200

    GfxAxialShading::getParameterRange: Fix potential divide by zero
    
    fixes oss-fuzz/8436

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 97c6d0d1..21c09c8f 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -4176,7 +4176,13 @@ void GfxAxialShading::getParameterRange(double *lower, double *upper,
 
   pdx = x1 - x0;
   pdy = y1 - y0;
-  invsqnorm = 1.0 / (pdx * pdx + pdy * pdy);
+  const double invsqnorm_denominator = (pdx * pdx + pdy * pdy);
+  if (unlikely(invsqnorm_denominator == 0)) {
+    *lower = 0;
+    *upper = 0;
+    return;
+  }
+  invsqnorm = 1.0 / invsqnorm_denominator;
   pdx *= invsqnorm;
   pdy *= invsqnorm;
 


More information about the poppler mailing list