pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1837439 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
Date Sat, 04 Aug 2018 17:29:50 GMT
Author: tilman
Date: Sat Aug  4 17:29:50 2018
New Revision: 1837439

URL: http://svn.apache.org/viewvc?rev=1837439&view=rev
Log:
PDFBOX-4283: treat invalid elements as 0

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java?rev=1837439&r1=1837438&r2=1837439&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java Sat Aug  4 17:29:50
2018
@@ -534,9 +534,11 @@ public class COSArray extends COSBase im
     public float[] toFloatArray()
     {
         float[] retval = new float[size()];
-        for( int i=0; i<size(); i++ )
+        for (int i = 0; i < size(); i++)
         {
-            retval[i] = ((COSNumber)getObject( i )).floatValue();
+            COSBase base = getObject(i);
+            retval[i] =
+                base instanceof COSNumber ? ((COSNumber) base).floatValue() : 0;
         }
         return retval;
     }



Mime
View raw message