[
https://issues.apache.org/jira/browse/PDFBOX-988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056864#comment-13056864
]
Adam Nichols commented on PDFBOX-988:
-------------------------------------
Since permission to include this PDF was granted, I created a JUnit test to
determine if this PDF will cause the JVM to hang/crash. It runs without
crashing nor hanging for me. It is important to note that I am not using the
Oracle JVM, I'm using OpenJDK. I'd also like to mention that the were one
SEVERE and several WARNING log messages, which I am including below. Bottom
line: the file seems to have some technical issues, but it doesn't seem to be
anything that PDFBox and the OpenJDK can not handle.
Since the JUnit test (PDSimpleFontTest::testPDFBox988()) is now in place, and
the PDF is included in the "resources" section, it should be easy to either
duplicate the error, or duplicate my test results. If you test this, please
include your JVM info (`java -version`) so we can see where it works and where
it doesn't. At this point it looks like a JVM bug, but it'd be good to have
more data to confirm this.
$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.8) (6b20-1.9.8-0ubuntu1~10.10.1)
OpenJDK Server VM (build 19.0-b09, mixed mode)
Jun 28, 2011 3:25:05 PM org.apache.pdfbox.filter.FlateFilter decode
SEVERE: Stop reading corrupt stream
Jun 28, 2011 3:25:05 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <พ> from <Tahoma> to the default font
Jun 28, 2011 3:25:06 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <ล> from <Tahoma> to the default font
Jun 28, 2011 3:25:06 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <ั> from <Tahoma> to the default font
Jun 28, 2011 3:25:06 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <ง> from <Tahoma> to the default font
Jun 28, 2011 3:25:06 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <ร> from <Tahoma> to the default font
Jun 28, 2011 3:25:06 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <ั> from <Tahoma> to the default font
Jun 28, 2011 3:25:06 PM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <ก> from <Tahoma> to the default font
> 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
>
>
> 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