pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1693317 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/PDShadingResources.java
Date Wed, 29 Jul 2015 17:08:46 GMT
Author: tilman
Date: Wed Jul 29 17:08:46 2015
New Revision: 1693317

URL: http://svn.apache.org/r1693317
Log:
PDFBOX-2909: throw IOException if /Function element not dictionary or array

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/PDShadingResources.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/PDShadingResources.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/PDShadingResources.java?rev=1693317&r1=1693316&r2=1693317&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/PDShadingResources.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/PDShadingResources.java
Wed Jul 29 17:08:46 2015
@@ -356,8 +356,8 @@ public abstract class PDShadingResources
     /**
      * Provide the function(s) of the shading dictionary as array.
      *
-     * @return an array containing the function(s)
-     * @throws IOException throw if something went wrong
+     * @return an array containing the function(s).
+     * @throws IOException if we were unable to create a function.
      */
     private PDFunction[] getFunctionsArray() throws IOException
     {
@@ -369,7 +369,7 @@ public abstract class PDShadingResources
                 functionArray = new PDFunction[1];
                 functionArray[0] = PDFunction.create(functionObject);
             }
-            else
+            else if (functionObject instanceof COSArray)
             {
                 COSArray functionCOSArray = (COSArray) functionObject;
                 int numberOfFunctions = functionCOSArray.size();
@@ -379,6 +379,10 @@ public abstract class PDShadingResources
                     functionArray[i] = PDFunction.create(functionCOSArray.get(i));
                 }
             }
+            else
+            {
+                throw new IOException("mandatory /Function element must be a dictionary or
an array");
+            }
         }
         return functionArray;
     }



Mime
View raw message