Bug 689954

Summary: MOAB-06-01-2007.pdf eats up all cpu and stalls ghostscript.
Product: Ghostscript Reporter: Bernhard Weisshuhn <bkw>
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: NOTIFIED FIXED    
Severity: critical    
Priority: P4    
Version: 8.70   
Hardware: All   
OS: All   
URL: http://projects.info-pull.com/moab/MOAB-06-01-2007.html
Customer: Word Size: ---
Attachments: patch

Description Bernhard Weisshuhn 2008-07-09 04:32:39 UTC
The file http://projects.info-pull.com/moab/bug-files/MOAB-06-01-2007.pdf makes
ghoscript 8.62 and current svn spit out a warning about a broken XREF table, and
then continues to eat up all CPU resources.

A detailed description of the design flaw illustrated by this pdf is available
at http://projects.info-pull.com/moab/MOAB-06-01-2007.html, also mentioning
potential more severe implications, which may or may not apply to ghostscript.
Other vendors have patched their clients in the meantime (Apple, Adobe, Poppler).
I.e. Poppler limited the max depth of recursive calls for reading the PageTree.
Maybe ghostscript could impose a sensible limit on these as well?

regards,
  bkw
Comment 1 Marcos H. Woehrmann 2008-07-09 06:59:22 UTC
Verified with 8.62 and head (r8825).
Comment 2 Alex Cherepanov 2008-07-28 22:00:41 UTC
Created attachment 4247 [details]
patch

Check for loops in the 'page tree' but accept an acyclic graph.
Report /syntaxerror and terminate the job when the loop is detected.

Regression testing shows no differences. We don't have other files so badly
broken.
Comment 3 Alex Cherepanov 2008-08-03 10:56:45 UTC
The patch is committed as a rev. 8933.