Bug 691000

Summary: /rangecheck in --run-- Gigs Failure case 2
Product: Ghostscript Reporter: Jason Giglio <gigs>
Component: PDF InterpreterAssignee: Michael Vrhel <michael.vrhel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description Jason Giglio 2009-12-15 06:38:41 UTC
[sysadm@bourbon scripts]$ gsc -dNOPAUSE -dBATCH -sOutputFile=/dev/shm/temp
-sDEVICE=tiffsep -r20 -f /storage/archive/20699PLC510.pdf
GPL Ghostscript SVN PRE-RELEASE 8.71 (2009-08-01)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Error: /rangecheck in --run--
Operand stack:
   --dict:13/22(L)--   1   10   false
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--  
--nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877
  1   3   %oparray_pop   1861   1   3   %oparray_pop   --nostringval--  
--nostringval--   2   1   1   --nostringval--   %for_pos_int_continue  
--nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--
  --nostringval--
Dictionary stack:
   --dict:1153/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--  
--dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:287/300(ro)(G)--  
--dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:1/1(ro)(G)--  
--dict:1/1(ro)(G)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 8.71: Unrecoverable error, exit code 1
Comment 1 Jason Giglio 2009-12-15 06:44:24 UTC
[sysadm@bourbon scripts]$ gsc -dNOPAUSE -dBATCH -sOutputFile=/dev/shm/temp
-sDEVICE=tiffsep -r20 -f /storage/archive/01344AKD700.pdf
GPL Ghostscript SVN PRE-RELEASE 8.71 (2009-08-01)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Error: /rangecheck in --run--
Operand stack:
   --dict:13/22(L)--   1   10   3
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--  
--nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877
  1   3   %oparray_pop   1861   1   3   %oparray_pop   --nostringval--  
--nostringval--   2   1   1   --nostringval--   %for_pos_int_continue  
--nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--
  --nostringval--
Dictionary stack:
   --dict:1153/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--  
--dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:287/300(ro)(G)--  
--dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:1/1(ro)(G)--  
--dict:1/1(ro)(G)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 8.71: Unrecoverable error, exit code 1
Comment 2 Jason Giglio 2009-12-15 06:45:20 UTC
Created attachment 5773 [details]
01344AKD700.pdf
Comment 3 Alex Cherepanov 2009-12-19 14:18:46 UTC
The problem is caused by DeviceN color space that appears to be
incompatible with /SoftMask implementation. 
.begintransparencymaskimage operator takes the current color space
as a blend color space, which appears to be incorrect.
Additionally, DeviceN as a blend color space is not implemented.

Transparency issues are not exactly my specialty.
The purpose of the following patch is to show where the problem
happens rather than fix it. With the path applied, the file runs
to completion. otherwise, it fails at the line gstrans.c:621 starting
a cascade of errors.

Regression run shows differences in 
Bug689581.pdf.psdcmyk.72.0
Bug689895.pdf.psdcmyk.72.0
Bug689897.pdf.psdcmyk.72.0
Bug689918.pdf.psdcmyk.72.0
Bug690022.pdf.psdcmyk.72.0
Bug690115.pdf.psdcmyk.72.0
IA3Z3225.pdf.psdcmyk.72.0

--- gs/Resource/Init/pdf_draw.ps	(revision 10517)
+++ gs/Resource/Init/pdf_draw.ps	(working copy)
@@ -1335,9 +1335,10 @@
     currentdevice .devicename /pdfwrite eq {
       pop	% pdfwrite will process SMask directly during 'doimage'
     } {
+      gsave //nodict begin
+      /DeviceGray setcolorspace
       .begintransparencymaskimage
       PDFfile fileposition exch
-      gsave //nodict begin
       null /SoftMask gput
       1 .setopacityalpha 1 .setshapealpha
       1 CA 1 ca
Comment 4 Michael Vrhel 2009-12-19 17:54:18 UTC
I will take a look at this.  Just a note.  DeviceN cannot be a blending space
for a softmask.  The tint transform must always be used.  The reason is that the
eventual output of the softmask is always a monochrome buffer.    
Comment 5 Jason Giglio 2010-02-24 10:54:17 UTC
Created attachment 5987 [details]
05000CBF327.pdf
Comment 6 Michael Vrhel 2010-04-29 17:18:14 UTC
These are fixed with the color changes that exist in the icc branch.  I will close this bug when the merge occurs.  Merge is likely to be in May 2010.
Comment 7 Jason Giglio 2010-06-11 13:43:59 UTC
Appears to be fixed in head