pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1745244 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Date Mon, 23 May 2016 19:13:54 GMT
Author: tilman
Date: Mon May 23 19:13:54 2016
New Revision: 1745244

URL: http://svn.apache.org/viewvc?rev=1745244&view=rev
Log:
PDFBOX-3360: avoid infinite or NaN values for dash

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1745244&r1=1745243&r2=1745244&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Mon
May 23 19:13:54 2016
@@ -561,10 +561,22 @@ public class PageDrawer extends PDFGraph
             phaseStart = (int)transformWidth(phaseStart);
 
             // empty dash array is illegal
-            if (dashArray.length == 0)
+            // avoid also infinite and NaN values (PDFBOX-3360)
+            if (dashArray.length == 0 || Float.isInfinite(phaseStart) || Float.isNaN(phaseStart))
             {
                 dashArray = null;
             }
+            else
+            {
+                for (int i = 0; i < dashArray.length; ++i)
+                {
+                    if (Float.isInfinite(dashArray[i]) || Float.isNaN(dashArray[i]))
+                    {
+                        dashArray = null;
+                        break;
+                    }
+                }
+            }
         }
         return new BasicStroke(lineWidth, state.getLineCap(), state.getLineJoin(),
                                state.getMiterLimit(), dashArray, phaseStart);



Mime
View raw message