[gs-cvs] rev 8308 - trunk/gs/lib

alexcher at ghostscript.com alexcher at ghostscript.com
Sat Oct 20 16:14:30 PDT 2007


Author: alexcher
Date: 2007-10-20 16:14:30 -0700 (Sat, 20 Oct 2007)
New Revision: 8308

Modified:
   trunk/gs/lib/pdf_draw.ps
Log:
Check for unbalanced q operators in the pattern stream and add Q as needed.
Bug 689523, customer 870.

DIFFERENCES:
None.


Modified: trunk/gs/lib/pdf_draw.ps
===================================================================
--- trunk/gs/lib/pdf_draw.ps	2007-10-20 19:14:28 UTC (rev 8307)
+++ trunk/gs/lib/pdf_draw.ps	2007-10-20 23:14:30 UTC (rev 8308)
@@ -739,16 +739,27 @@
 	% so for simplicity, we always do it.
   PDFfile fileposition 3 1 roll
   q
-  null sc1 null SC1
+  //null sc1 //null SC1
 
   % save old value of pdfemptycount on opstack, set to new value
   pdfemptycount /pdfemptycount count 3 sub def 3 1 roll
-  exch false resolvestream pdfopdict .pdfruncontext
+  countdictstack 3 1 roll
+
+  exch //false resolvestream pdfopdict .pdfruncontext
+
+  countdictstack exch sub dup 0 gt { 
+     (   **** Warning: Pattern stream has imbalanced q/Q operators (too many q's)\n)
+     pdfformaterror
+     { Q } repeat
+   } {
+     pop
+   } ifelse
+
   % restore pdfemptycount
   /pdfemptycount exch def
 
   Q
-  PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { true } ifelse { (%End PaintProc) print dup === flush } if } if
+  PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%End PaintProc) print dup === flush } if } if
   PDFfile exch setfileposition
 } bdef
 



More information about the gs-cvs mailing list