[poppler] poppler/Gfx.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed May 23 17:35:56 UTC 2018


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

New commits:
commit 86991adb172fd55decdc72ec6fc34d41b19beafa
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed May 23 19:35:27 2018 +0200

    Gfx::doRadialShFill: Fix potential divide by zero
    
    fixes oss-fuzz/8476

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 01ededcd..af6fb9bd 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -2938,7 +2938,12 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) {
     xz = x0 + sz * (x1 - x0);
     yz = y0 + sz * (y1 - y0);
     enclosed = (xz - x0) * (xz - x0) + (yz - y0) * (yz - y0) <= r0 * r0;
-    theta = asin(r0 / sqrt((x0 - xz) * (x0 - xz) + (y0 - yz) * (y0 - yz)));
+    const double theta_aux = sqrt((x0 - xz) * (x0 - xz) + (y0 - yz) * (y0 - yz));
+    if (likely(theta_aux != 0)) {
+      theta = asin(r0 / theta_aux);
+    } else {
+      theta = 0;
+    }
     if (r0 > r1) {
       theta = -theta;
     }


More information about the poppler mailing list