Bug 690307 - Error: /stackoverflow in --run--
Summary: Error: /stackoverflow in --run--
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: Macintosh MacOS X
: P1 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 14:00 UTC by Marcos H. Woehrmann
Modified: 2009-03-10 09:41 UTC (History)
0 users

See Also:
Customer: 850
Word Size: ---


Attachments
patch (1.17 KB, patch)
2009-03-07 14:52 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2009-02-25 14:00:10 UTC
The customer reports that Ghostscript generates a "Error: /stackoverflow in --run--" when reading the 
file 27742.pdf.  I've duplicated this issue with gs8.54, gs8.64, and head (r9505).

The command line I'm using for testing:

  bin/gs -sDEVICE=ppmraw -o test.ppm ./27742.pdf

Because of the files large size it can be found in casper:/home/support/690307
Comment 1 Alex Cherepanov 2009-03-02 11:55:09 UTC
The sample file defines a dictionary with about 40000 elements.
Ghostscript uses operators -<<-- and -->>-- to construct the dictionary and
overflows the operand stack.
Comment 2 Ray Johnston 2009-03-02 12:14:07 UTC
So, why not just bump up our MaxOpStack parameter when parsing PDF's ?
Comment 3 Alex Cherepanov 2009-03-07 14:52:15 UTC
Created attachment 4833 [details]
patch

Following Adobe implementation, copy only a few top elements of the stack
to the corresponding element of the $error dictionary when the stack
overflows. Adobe copies up to 500 top elements, we copy up to 65535. This
feature enables Ghostscript to have maximum stack sizes larger than 65535.
The maximum operand stack size is set to 100000 to match Adobe interpreters.
The large stack size is needed for some PDF files that construct large
dictionaries using << ... >> operators.
Comment 4 Alex Cherepanov 2009-03-07 15:34:43 UTC
The patch is committed as a rev. 9536.
CET 27-05.ps prints the maximum stack sizes, the operand stack size
is now equal to Adobe's.