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

Andreas Lehmkühler commented on PDFBOX-1616:
--------------------------------------------

Sorry, no offense, but your patch doesn't make any sense

- you can't verify that your changes fix the described issue
- CMaps don't use values bigger than 0xFFFFFFFF, so that long values aren't 
necessary
- the CMap doesn't depend on the text content itself, it's the other way around

Having a look at the stacktrace I found the following facts:

- when adding a new font to an existing pdf, all embedded fonts are loaded at 
first
- the problematic font is a Type0Font
- 8900146484 is part of the CMap of that font

That leads to the conclusion:

- the issue doesn't depend on the font which is used to add the text
- the issue doesn't depend on the text content to be added
- either the CMap of the Type0 font is mal formed or the CMap parser is 
erroneous

Can you provide us with the pdf which produces the given stacktrace? 



                
> NumberFormatException i CMapParser.parseNextToken()
> ---------------------------------------------------
>
>                 Key: PDFBOX-1616
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1616
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 1.8.1
>            Reporter: Thomas Fossum
>         Attachments: Rewritten_CMapParser_from_using_ints_to_longs.patch
>
>
> When using PDType1Font (any of the 14 fonts available), and adding text with 
> contentStream.drawString(), we get a NumberformatException for string with 9 
> characters, ex. "123456789" or "abcdefghi"
> Stacktrace:
> Caused by: java.lang.NumberFormatException: For input string: "8900146484"
>         at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>         at java.lang.Integer.parseInt(Integer.java:495)
>         at java.lang.Integer.<init>(Integer.java:677)
>         at 
> org.apache.fontbox.cmap.CMapParser.parseNextToken(CMapParser.java:541)
>         at org.apache.fontbox.cmap.CMapParser.parse(CMapParser.java:119)
>         at org.apache.pdfbox.pdmodel.font.PDFont.parseCmap(PDFont.java:603)
>         at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.extractToUnicodeEncoding(PDSimpleFont.java:458)
>         at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.determineEncoding(PDSimpleFont.java:426)
>         at org.apache.pdfbox.pdmodel.font.PDFont.<init>(PDFont.java:194)
>         at 
> org.apache.pdfbox.pdmodel.font.PDSimpleFont.<init>(PDSimpleFont.java:88)
>         at 
> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:65)
>         at 
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:108)
>         at 
> org.apache.pdfbox.pdmodel.PDResources.getFonts(PDResources.java:203)
>         at org.apache.pdfbox.pdmodel.PDResources.addFont(PDResources.java:588)
>         at org.apache.pdfbox.pdmodel.PDResources.addFont(PDResources.java:574)
>         at 
> org.apache.pdfbox.pdmodel.edit.PDPageContentStream.setFont(PDPageContentStream.java:308)
> Issue https://issues.apache.org/jira/browse/PDFBOX-1225 handles a similar 
> error: An attempt to Integer.parseString() is made with a value > 
> Integer.MAX_VALUE.
> Line 541 in CMAPParser.java should probably use Long datatype.
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to