pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1817221 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java
Date Tue, 05 Dec 2017 17:41:10 GMT
Author: tilman
Date: Tue Dec  5 17:41:10 2017
New Revision: 1817221

URL: http://svn.apache.org/viewvc?rev=1817221&view=rev
Log:
PDFBOX-4027: ignore matrix if not COSArray with 6 elements

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java?rev=1817221&r1=1817220&r2=1817221&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/form/PDFormXObject.java
Tue Dec  5 17:41:10 2017
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import org.apache.pdfbox.contentstream.PDContentStream;
 import org.apache.pdfbox.cos.COSArray;
+import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSFloat;
 import org.apache.pdfbox.cos.COSName;
@@ -206,16 +207,16 @@ public class PDFormXObject extends PDXOb
     }
 
     /**
-     * This will get the optional Matrix of an XObjectForm. It maps the form space to user
space.
+     * This will get the optional matrix of an XObjectForm. It maps the form space to user
space.
      * @return the form matrix if available, or the identity matrix.
      */
     @Override
     public Matrix getMatrix()
     {
-        COSArray array = (COSArray) getCOSObject().getDictionaryObject(COSName.MATRIX);
-        if (array != null)
+        COSBase base = getCOSObject().getDictionaryObject(COSName.MATRIX);
+        if (base instanceof COSArray && ((COSArray) base).size() >= 6)
         {
-            return new Matrix(array);
+            return new Matrix((COSArray) base);
         }
         else
         {



Mime
View raw message