[ 
https://issues.apache.org/jira/browse/PDFBOX-4301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16593841#comment-16593841
 ] 

ASF subversion and git services commented on PDFBOX-4301:
---------------------------------------------------------

Commit 1839345 from [email protected] in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1839345 ]

PDFBOX-4301: check object type before casting to COSNumber in
PDExtendedGraphicsState.getFloatItem; plus additionall fix as
getFloatItem() might (now) return null with existing key we also have to
handle this case in copyIntoGraphicsState() where an implicit unboxing
is done; fix sets default values (from PDGraphicsState) in case the
value from PDExtendedGraphicsState is wrong (null)

> ClassCastException in PDExtendedGraphicsState
> ---------------------------------------------
>
>                 Key: PDFBOX-4301
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4301
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 2.0.11
>            Reporter: Timo Boehme
>            Assignee: Timo Boehme
>            Priority: Minor
>
> The method PDExtendedGraphicsState.getFloatItem contains a non checked cast 
> to COSNumber for a dictionary object. In a specific journal PDF document I 
> get the following exception:
> {noformat}
> at 
> org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState.getFloatItem(PDExtendedGraphicsState.java:591)
>         at 
> org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState.getStrokingAlphaConstant(PDExtendedGraphicsState.java:482)
>         at 
> org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState.copyIntoGraphicsState(PDExtendedGraphicsState.java:130)
>         at 
> org.apache.pdfbox.contentstream.operator.state.SetGraphicsStateParameters.process(SetGraphicsStateParameters.java:61)
>         at 
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848){noformat}
> because the PDF contains
> {noformat}
> /A4 <<
> /CA (1.0)
> /Type /ExtGState
> /ca (1.0)
> >>
> {noformat}
> where "(1.0)" is clearly wrong and should be "1.0".
> As this seems to be a more seldom error I would suggest to check dictionary 
> object type before casting and returning "null" for wrong type (as it is done 
> e.g. in PDExtendedGraphicsState.getFontSetting.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to