Bug 693045

Summary: **** File has unbalanced q/Q operators (too many Q's) ****
Product: Ghostscript Reporter: schipany
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: RESOLVED FIXED    
Severity: major CC: pablo
Priority: P4    
Version: 9.05   
Hardware: PC   
OS: Windows 7   
See Also: http://bugs.ghostscript.com/show_bug.cgi?id=692245
Customer: Word Size: ---
Attachments: 2 Log-Files and the test document.
i5.pdf -- simplified sample file

Description schipany 2012-05-16 08:48:28 UTC
Created attachment 8588 [details]
2 Log-Files and the test document.

9.0.5:
"ProgramFiles%\gs\gs9.05\bin\gswin32c.exe" -sDEVICE=tiff24nc -r96 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dSAFER -dBATCH -dNOPAUSE -sOutputFile="D:\14 - Aerzte GV (idF 1985
).tiff" "D:\14 - Aerzte GV (idF 1985).pdf" -c quit
**** File has unbalanced q/Q operators (too many Q's) ****
**** File has unbalanced q/Q operators (too many Q's) ****
endless loop!!!

9.0.4:
"ProgramFiles%\gs\gs9.04\bin\gswin32c.exe" -sDEVICE=tiff24nc -r96 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dSAFER -dBATCH -dNOPAUSE -sOutputFile="D:\14 - Aerzte GV (idF 1985
).tiff" "D:\14 - Aerzte GV (idF 1985).pdf" -c quit
   **** Error reading a content stream. The page may be incomplete.
   **** Warning: Pattern stream has unbalanced q/Q operators (too many q's)
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.
GPL Ghostscript 9.04: Unrecoverable error, exit code 1
Comment 1 Alex Cherepanov 2012-05-21 05:03:51 UTC
Created attachment 8604 [details]
i5.pdf -- simplified sample file

The sample file is incorrect. A few numbers in the file exceed the acceptable
range for numbers and cause a PS error.

Unfortunately, the error recovery code has an error of its own and
falls into a loop.
Comment 2 Alex Cherepanov 2012-09-09 23:06:20 UTC
A patch that
correctly restores PS stack when PDF stream run aborts
has been committed as:
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=3a56f4eb5a9f15795725374b297edab0fb8ebc5d