[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-2015-g3bf992e

[email protected] (Ken Sharp) Sat, 7 Dec 2019 15:02:19 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  3bf992e26006c8af9e137822159eb7c7540462c0 (commit)
      from  539fe73419fdf00ffd7747a2cf890e56bc6f0504 (commit)

----------------------------------------------------------------------
commit 3bf992e26006c8af9e137822159eb7c7540462c0
Author: Ken Sharp <[email protected]>
Date:   Sat Dec 7 15:02:15 2019 +0000

    PDF interpreter - Accept /ColorSpace as well as /CS in group attribute dictionary
    
    Again, no bug report, the customer has asked that the file be kept
    confidential
    
    The problem is due to a group attribute dictionary for an SMask. The
    dictionary is required to contain a /CS (colour space) entry in order
    to correctly set the background. In this case, however, the dictionary
    contains a /ColorSpace entry.
    
    I've chosen to implement treating the /ColorSpace as a /CS entry, this
    is not what Acrobat does, but mimicking Acrobat's behaviour is more or
    less impossible for us. We do emit a warning.

diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps
index e5b7e8e..d64120e 100644
--- a/Resource/Init/pdf_draw.ps
+++ b/Resource/Init/pdf_draw.ps
@@ -549,9 +549,25 @@ end
         cleartomark //null exit
       } if
       gsave //nodict begin
-        /CS knownoget {
+        dup /CS knownoget {
+          exch pop
           resolvecolorspace dup setgcolorspace csput
-        } if
+        }
+        {
+          % Group attributes dictionaries are supposed to contain a /CS
+          % entry, but Acrobat apparently also handles a /ColorSpace....
+          /ColorSpace knownoget {
+            (   **** Error: A transparency group XObject has a /ColorSpace instead of /CS attribute.\n)
+            pdfformaterror
+            resolvecolorspace dup setgcolorspace csput
+          }
+          {
+            (   **** Error: Ignoring a transparency group XObject without /CS attribute.\n)
+            pdfformaterror
+            (               Output may be incorrect.\n) pdfformaterror
+            cleartomark //null exit
+          }ifelse
+        } ifelse
         aload pop setcolor [ currentgray ]
       end grestore
       /GrayBackground exch 3 2 roll
@@ -643,9 +659,19 @@ def
     resolvecolorspace dup setgcolorspace csput
     //true		% use currentcolorspace
   } {
-    % inheriting the colorspace -- make sure Device* spaces are not CIEBased
-    forceDefaultCS currentcolorspace 0 get .knownget { exec } if
-    //false		% no defined colorspace
+    % Group attributes dictionaries are supposed to contain a /CS
+    % entry, but Acrobat apparently also handles a /ColorSpace....
+    dup /Group oget /ColorSpace knownoget {
+    (   **** Error: A transparency group attribute dictionary has a /ColorSpace instead of /CS attribute.\n)
+    pdfformaterror
+      resolvecolorspace dup setgcolorspace csput
+      //true		% use currentcolorspace
+    }
+    {
+      % inheriting the colorspace -- make sure Device* spaces are not CIEBased
+      forceDefaultCS currentcolorspace 0 get .knownget { exec } if
+      //false		% no defined colorspace
+    } ifelse
   } ifelse
   3 -1 roll dup
   dup 4 1 roll /BBox get aload pop .begintransparencymaskgroup


Summary of changes:
 Resource/Init/pdf_draw.ps | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)