pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1656409 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
Date Mon, 02 Feb 2015 08:38:50 GMT
Author: tilman
Date: Mon Feb  2 08:38:50 2015
New Revision: 1656409

URL: http://svn.apache.org/r1656409
Log:
PDFBOX-2653: fix bug related to missing DECODE_PARMS

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java?rev=1656409&r1=1656408&r2=1656409&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/xobject/PDCcitt.java
Mon Feb  2 08:38:50 2015
@@ -149,18 +149,28 @@ public class PDCcitt extends PDXObjectIm
             }
             decodeParms = (COSDictionary) ((COSArray) decodeP).getObject(index);
         }
-        int cols = decodeParms.getInt(COSName.COLUMNS, 1728);
-        int rows = decodeParms.getInt(COSName.ROWS, 0);
-        int height = stream.getInt(COSName.HEIGHT, 0);
-        if (rows > 0 && height > 0)
+
+        int cols, rows;
+        if (decodeParms == null)
         {
-            // ensure that rows doesn't contain implausible data, see PDFBOX-771
-            rows = Math.min(rows, height);
+            cols = stream.getInt(COSName.WIDTH, 1728);
+            rows = stream.getInt(COSName.HEIGHT, 0);
         }
         else
         {
-            // at least one of the values has to have a valid value
-            rows = Math.max(rows, height);
+            cols = decodeParms.getInt(COSName.COLUMNS, 1728);
+            rows = decodeParms.getInt(COSName.ROWS, 0);
+            int height = stream.getInt(COSName.HEIGHT, 0);
+            if (rows > 0 && height > 0)
+            {
+                // ensure that rows doesn't contain implausible data, see PDFBOX-771
+                rows = Math.min(rows, height);
+            }
+            else
+            {
+                // at least one of the values has to have a valid value
+                rows = Math.max(rows, height);
+            }
         }
         byte[] bufferData = null;
         ColorModel colorModel = null;



Mime
View raw message