Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.11
-
None
Description
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:
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)
because the PDF contains
/A4 << /CA (1.0) /Type /ExtGState /ca (1.0) >>
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.