Bug 692245 - Warning: Pattern stream has unbalanced q/Q operators (too many q's)
Summary: Warning: Pattern stream has unbalanced q/Q operators (too many q's)
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: PC All
: P2 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-31 09:06 UTC by Marcos H. Woehrmann
Modified: 2011-11-25 04:40 UTC (History)
1 user (show)

See Also:
Customer: 700
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2011-05-31 09:06:46 UTC
The customer reports and I've verified that Ghostscript reports the warning "Warning: Pattern stream has unbalanced q/Q operators (too many q's)" before generating a "/typcheck in --run--" error.  This occurs with all versions of Ghostscript I tested, including head (d0055ac144c1f1a51e906976b85e8e2119b5a2db).  

The command line I'm using for testing:

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


Acrobat 10 and Apple Preview read the file without difficulty, mupdf produces the message:

Assertion failed: (contrib_cols == NULL || contrib_cols->count == dst_w_int), function fz_scale_pixmap, file draw/draw_scale.c, line 1091.
Comment 2 Alex Cherepanov 2011-05-31 13:29:43 UTC
The file has a rather long number:

36.00000 0.00000 0.00000 36.00000 0.0000 -43583108498802323000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000 cm

If this number is replaced with an ordinary one, the file runs to completion.
Comment 3 Robin Watts 2011-05-31 14:57:37 UTC
The same line causes the problem in mupdf - the scale function is entered with an invalid matrix. A fix for this has been developed and is working it's way into the mupdf repo now.
Comment 4 Alex Cherepanov 2011-06-01 04:35:43 UTC
Make pattern handling code tolerant to pattern streams that leave
some junk on the operand stack. For instance, this can happen when
processing of a stream terminates prematurely.

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=db4af9eaf902dbac931ca8c88c586df9d160fb72