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

John Hewson commented on PDFBOX-2339:
-------------------------------------

PDType1Font should probably throw an IOException in this case. It's the 
caller's responsibility not to pass empty data though.

> ArrayIndexOutOfBoundsException when type1 font is empty
> -------------------------------------------------------
>
>                 Key: PDFBOX-2339
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2339
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>         Attachments: PDFBOX-2339-168002.pdf
>
>
> Exception when rendering page 2 of the attached file:
> {code}
> Exception in thread "AWT-EventQueue-0" 
> java.lang.ArrayIndexOutOfBoundsException: 0
>         at 
> org.apache.fontbox.type1.Type1Parser.parseASCII(Type1Parser.java:77)
>         at org.apache.fontbox.type1.Type1Parser.parse(Type1Parser.java:62)
>         at 
> org.apache.fontbox.type1.Type1Font.createWithSegments(Type1Font.java:70)
> {code}
> The font is empty:
> {code}
> 249 0 obj
> << 
> /FontFile 250 0 R 
> /Type /FontDescriptor 
> /Ascent 833 
> /CapHeight 708 
> /Descent 250 
> /Flags 34 
> /FontBBox [ -170 -251 1020 934 ] 
> /FontName /Bodoni-Italic 
> /ItalicAngle 0 
> /StemV 0 
> >> 
> endobj
> 250 0 obj
> << /Length 3 /Filter [ /ASCII85Decode ] /Length1 0 /Length2 0 /Length3 0 >> 
> stream
> ~>
> endstream
> endobj
> {code}
> AR brings a warning, but is able to render the page.
> Skipping the parse call in PDType1Font.java can also render the page. 
> Changing type1Parser.parse() to return null if the font is empty might also 
> succeed, although I didn't test that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to