[poppler] poppler/SplashOutputDev.cc

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


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

New commits:
commit ace7ca3e0dd1570ef6804c0f054742b2996b9b9f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue May 22 20:10:01 2018 +0200

    SplashAxialPattern: fix potential divide by zero

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index a19e8c66..140917d3 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -453,7 +453,12 @@ SplashAxialPattern::SplashAxialPattern(SplashColorMode colorModeA, GfxState *sta
   shadingA->getCoords(&x0, &y0, &x1, &y1);
   dx = x1 - x0;
   dy = y1 - y0;
-  mul = 1 / (dx * dx + dy * dy);
+  const double mul_denominator = (dx * dx + dy * dy);
+  if (unlikely(mul_denominator == 0)) {
+    mul = 0;
+  } else {
+    mul = 1 / mul_denominator;
+  }
   shadingA->getColorSpace()->getDefaultColor(&srcColor);
   convertGfxColor(defaultColor, colorModeA, shadingA->getColorSpace(), &srcColor);
 }


More information about the poppler mailing list