pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1770257 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java
Date Thu, 17 Nov 2016 19:01:46 GMT
Author: tilman
Date: Thu Nov 17 19:01:46 2016
New Revision: 1770257

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

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java?rev=1770257&r1=1770256&r2=1770257&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java Thu
Nov 17 19:01:46 2016
@@ -432,10 +432,22 @@ public class PageDrawer extends PDFStrea
                 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;
+                        }
+                    }
+                }
             }
             currentStroke = new BasicStroke(lineWidth, stroke.getEndCap(), stroke.getLineJoin(),
                     stroke.getMiterLimit(), dashArray, phaseStart);



Mime
View raw message