Summary: | ghostscript hangs at 100% cpu when converting this pdf to png | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | David <blahblah676> |
Component: | PDF Interpreter | Assignee: | Ray Johnston <ray.johnston> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | ere.maijala, jeroen, sphinx.pinastri |
Priority: | P4 | ||
Version: | 9.52 | ||
Hardware: | PC | ||
OS: | All | ||
Customer: | Word Size: | --- | |
Attachments: |
test pdf file which causes hang
Simplified sample file Patch New patch |
Description
David
2020-05-07 21:30:11 UTC
There are TWO input files processed by the given command line: '-f/tmp/magick-6602wAEeyPyqRg96' '-f/tmp/magick-66022lIqEaMvwCN9' I am able to duplicate the problem with the attached file, however. Not sure what ImageMagick does internally. To test I'm just running "magick test2.pdf test2.png", and that gs command is what magick is running. When I upload the file to a pdf validator it shows lots of missing objects. It was originally converted from Adobe InDesign to pdf by PhotoShop as a Linearized pdf, then edited and saved a few times, so I suspect it got corrupted somewhere along the line. The problem is that the older versions of gs seem to handle it fine, it's just the recent versions that hang. Created attachment 19369 [details]
Simplified sample file
The loop is caused by a circular /ParentResources attribute.
This branch of code is triggered by an error in the sample file: misplaced /Form resources in a Type 3 font. This font has /Resource dictionaries added to /CharProcs entries rather than the font dictionary.
This simplified sample file keeps the malformed Type 3 font but disposes of everything else.
I'll review the patch, but examining this shows there are issues with where the Resource is supposed to come from. Any update on this? I'm also having this issue. I'm willing to test patches. The patch from #4 seems to fix the issue for me. The pdf (https://digi.kansalliskirjasto.fi/sanomalehti/binding/423358/pdf/Keski_Suomi_23_06_06_1874.pdf) downloaded from page: https://digi.kansalliskirjasto.fi/sanomalehti/binding/423358?page=1&set_language=en is exhibiting the same 100% CPU behavior with the following command: gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r150 -dFirstPage=1 -dLastPage=1 -sDEVICE=jpeg -o test.jpg Keski_Suomi_23_06_06_1874.pdf Is this maybe the same issue or should I file another one? The sample file from the comment #8 demonstrates a unrelated problem. It is something that loops around .addbfrange . Please open a separate bug report. Ere Maijala, I opened a new bug 703246 to track this issue. I also submitted a proposed patch that solves it. (In reply to Peter Cherepanov from comment #10) > Ere Maijala, I opened a new bug 703246 to track this issue. > I also submitted a proposed patch that solves it. Thank you! Fixed in commit ec2699f50aa3ada4ef2c477c7577331a3950bcc8, but this does not resolve the CharProc lookup. Commit 2aaa240515d77b486adfd9d217c32d3cad7683f5 is needed to fix the rendering, preventing the multiple instances of the logo along the right side. |