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

Ray Johnston <[email protected]> Thu, 15 Jul 2004 07:40:01 -0700
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Dan,

Looks OK to me.

As you probably noticed, while we were on the call I implemented
the other approach (checking if the second parameter to scn was
a number), but I like this approach better that the hack on a
hack. I'm glad you found the problem with your earlier method.

Regards,
Ray
________________________________________________________________

Dan Coby wrote:

> 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
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
> 
>