[
https://issues.apache.org/jira/browse/PDFBOX-988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056994#comment-13056994
]
Craig Stires commented on PDFBOX-988:
-------------------------------------
Thanks for looking into this.
I will re-run my tests, and see if I have any error output different from yours
Configuration: Ubuntu 8.04 LTS
Linux mach01 2.6.24-28-virtual #1 SMP Fri Feb 11 17:51:21 UTC 2011 i686
root@mach01:~# java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
Also, apologies for the change, but realized that my patch and my
recommendation were slightly out of sync. The value for minimum glyph in the
patch should be 40 (the patch has the value at 20). Testing a fairly large set
of pdfs didn't show any valid fonts with fewer than 40 glyphs, so want to be
more conservative to prevent hanging the system again.
Attaching the slightly changed patch.
> pdmodel.font.PDSimpleFont hanging on TrueType font (ubuntu)
> -----------------------------------------------------------
>
> Key: PDFBOX-988
> URL: https://issues.apache.org/jira/browse/PDFBOX-988
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.5.0
> Environment: Ubuntu 8.04 - Headless
> Reporter: Craig Stires
> Attachments: F001u_3_7j.pdf,
> pdsimplefont_rebuildfont_fewglyphs.patch,
> pdsimplefont_rebuildfont_fewglyphs_40.patch
>
>
> When calling PDPage.convertToImage(imagetype,resolution) , I have found a
> case where the application hangs. No error messages, no exceptions, no CPU
> spike, no I/O. The error had to do with some strange corruption of the
> awtFont, by the time it reached the method PDSimpleFont.drawString. Some
> pretty deep digging turned up that if a font with too few glyphs is sent into
> PDSimpleFont.writeFont, it will enter Graphics2D.drawString ... ne'er to
> return.
> If a check is done to count the glyphs and if they fall below a certain
> threshold, then just re-instantiate the Font, then all goes well. Typical
> numbers range from 70 to 1000+, so I've gone with an arbitrary value of 40.
> All goes well, and I can't measure any difference in performance (except that
> my app will actually return from attempting this doc!).
> Attached is a sample PDF which can re-create the problem, and a patch which
> seems to solve it sensibly.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira