FW: Fix for 687572 AFPL Ghostscript 8.14 fails with some PDF files

"Dan Coby" <[email protected]> Thu, 15 Jul 2004 00:50:09 -0700
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Fix for 687572 AFPL Ghostscript 8.14 fails with some PDF files.

DETAILS:

The given file uses the scn operator inside of a form.  The scn
operator is used for defining a color with DeviceN color spaces.
The scn operator uses .pdfcount (inside of scresolve) to determine
the number of parameters.  However inside a form, there is an extra
dictionary on the stack.

The fix consists of adjusting pdfemptycount (which is used by .pdfcount)
to match the stack depth while executing a form.  After the form is
executed, pdfemptycount is returned to its previous value.


Dan


Index: lib/pdf_draw.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/pdf_draw.ps,v
retrieving revision 1.82
diff -u -r1.82 pdf_draw.ps
--- lib/pdf_draw.ps     17 Jun 2004 13:05:16 -0000      1.82
+++ lib/pdf_draw.ps     15 Jul 2004 07:40:31 -0000
@@ -983,7 +983,10 @@
   3 index false /resolvestream cvx
   /.paintform cvx
   ] cvx /PaintProc exch put
-  q execform Q         % gsave / grestore around the Form
+    % Adjust pdfemptycount since we have an extra dictionary on the stack
+  pdfemptycount exch /pdfemptycount count 2 sub def
+  q execform Q                 % gsave / grestore around the Form
+  /pdfemptycount exch def      % Restore pdfemptycount
 } bdef

 /_dops_save 1 array def