pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1788013 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
Date Tue, 21 Mar 2017 17:39:07 GMT
Author: tilman
Date: Tue Mar 21 17:39:06 2017
New Revision: 1788013

URL: http://svn.apache.org/viewvc?rev=1788013&view=rev
Log:
PDFBOX-3728: avoid NPE

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java?rev=1788013&r1=1788012&r2=1788013&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
Tue Mar 21 17:39:06 2017
@@ -80,10 +80,19 @@ public final class PDICCBased extends PD
      * Creates a new ICC color space using the PDF array.
      *
      * @param iccArray the ICC stream object
-     * @throws java.io.IOException if there is an error reading the ICC profile.
+     * @throws IOException if there is an error reading the ICC profile or if the parameter
is
+     * invalid.
      */
     public PDICCBased(COSArray iccArray) throws IOException
     {
+        if (iccArray.size() < 2)
+        {
+            throw new IOException("ICCBased colorspace array must have two elements");
+        }
+        if (!(iccArray.getObject(1) instanceof COSStream))
+        {
+            throw new IOException("ICCBased colorspace array must have a stream as second
element");
+        }
         array = iccArray;
         stream = new PDStream((COSStream) iccArray.getObject(1));
         loadICCProfile();



Mime
View raw message