pdfbox-commits mailing list archives

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

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

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

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java?rev=1837438&r1=1837437&r2=1837438&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java Sat Aug 
4 17:29:43 2018
@@ -523,9 +523,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