Hi,

Indeed, I updated the code in the revision r1436553.

BR,
Eric


2013/1/20 Andreas Lehmkuehler <[email protected]>

> Hi,
>
> Am 20.01.2013 17:33, schrieb [email protected]:
>
>> Author: leleueri
>> Date: Sun Jan 20 16:33:31 2013
>> New Revision: 1435877
>>
>> URL: 
>> http://svn.apache.org/viewvc?**rev=1435877&view=rev<http://svn.apache.org/viewvc?rev=1435877&view=rev>
>> Log:
>> PDFBOX-1497 : avoid ArrayOutOfBound on PDDeviceN.getAttributes
>>
>> Modified:
>>      pdfbox/trunk/pdfbox/src/main/**java/org/apache/pdfbox/**
>> pdmodel/graphics/color/**PDDeviceN.java
>>      pdfbox/trunk/preflight/src/**main/java/org/apache/pdfbox/**
>> preflight/graphic/**StandardColorSpaceHelper.java
>>
>> Modified: pdfbox/trunk/pdfbox/src/main/**java/org/apache/pdfbox/**
>> pdmodel/graphics/color/**PDDeviceN.java
>> URL: http://svn.apache.org/viewvc/**pdfbox/trunk/pdfbox/src/main/**
>> java/org/apache/pdfbox/**pdmodel/graphics/color/**
>> PDDeviceN.java?rev=1435877&r1=**1435876&r2=1435877&view=diff<http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDDeviceN.java?rev=1435877&r1=1435876&r2=1435877&view=diff>
>> ==============================**==============================**
>> ==================
>> --- pdfbox/trunk/pdfbox/src/main/**java/org/apache/pdfbox/**
>> pdmodel/graphics/color/**PDDeviceN.java (original)
>> +++ pdfbox/trunk/pdfbox/src/main/**java/org/apache/pdfbox/**
>> pdmodel/graphics/color/**PDDeviceN.java Sun Jan 20 16:33:31 2013
>> @@ -242,11 +242,16 @@ public class PDDeviceN extends PDColorSp
>>       {
>>           if ( deviceNAttributes == null )
>>           {
>> +               if (array.size() > DEVICEN_ATTRIBUTES) { // the DeviceN
>> contains an attributes dictionary
>>               deviceNAttributes = new PDDeviceNAttributes((**
>> COSDictionary)array.getObject(**DEVICEN_ATTRIBUTES));
>> +               } else {
>> +                       // create the Attributes dictionary
>> +                       setAttributes(new PDDeviceNAttributes());
>> +               }
>>
> Hmm, IMHO it doesn't make sense to return an instance of
> PDDeviceNAttributes
> if there isn't any value, because it is optional. Furthermore it won't make
> sense to add a hasAttributes method if the get method always returns a
> something
> other than null.
>
>            }
>>           return deviceNAttributes;
>>       }
>> -
>> +
>>       /**
>>        * This will set the color space attributes.  If null is passed in
>> then
>>        * all attribute will be removed.
>> @@ -272,6 +277,15 @@ public class PDDeviceN extends PDColorSp
>>       }
>>
>>       /**
>> +     * Returns true if the DeviceN color space has an attributes
>> dictionary
>> +     * @return
>> +     */
>> +    public boolean  hasAttributes()
>> +    {
>> +       return array.size() > DEVICEN_ATTRIBUTES;
>> +    }
>> +
>> +    /**
>>        * Returns the components of the color in the alternate colorspace
>> for the given tint value.
>>        * @param tintValues a list containing the tint values
>>        * @return COSArray with the color components
>>
>>  SNIP
>
> BR
> Andreas Lehmkühler
>
>

Reply via email to