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

alexcher at ghostscript.com alexcher at ghostscript.com
Tue Jun 12 19:42:04 PDT 2007


Author: alexcher
Date: 2007-06-12 19:42:04 -0700 (Tue, 12 Jun 2007)
New Revision: 8047

Modified:
   trunk/gs/lib/pdf_main.ps
Log:
Fix false detection of circular references in the resource chain. Valid PDF
resource references form a directed acyclic graph but the old code was
checking for a tree. Bug 688479.

DIFFERENCES:
None. 


Modified: trunk/gs/lib/pdf_main.ps
===================================================================
--- trunk/gs/lib/pdf_main.ps	2007-06-12 20:55:18 UTC (rev 8046)
+++ trunk/gs/lib/pdf_main.ps	2007-06-13 02:42:04 UTC (rev 8047)
@@ -1507,18 +1507,21 @@
 /resourceusestransparency {	% <dict> <dict> resourceusestransparency <bool>
   {	% Use loop to provide an exitable context.
     /Resources knownoget not { 0 dict } if
-    2 copy known {
-      (   **** File has circular references in resource dictionaries.\n)
-      pdfformaterror
-      pop false exit
+    2 copy .knownget {
+      { % Some circular references may be missed because scanning stops
+        % when the 1st transparency is found.
+        (   **** File has circular references in resource dictionaries.\n)
+        pdfformaterror
+      } if
+      pop //false exit
     } if
-    2 copy dup put
+    2 copy //true put              % In the current chain.
     dup /ExtGState knownoget {
       extgstateusestransparency
-      { pop true exit } if
+      { pop //true exit } if
     } if
     dup /XObject knownoget {
-      false exch {
+      //false exch {
 	exch pop oforce dup /Subtype get
 	dup /Image eq { 1 index /SMask known { pop pop not exit } if } if
 	/Form eq {
@@ -1526,9 +1529,10 @@
 	} {
 	  pop
 	} ifelse
-      } forall { pop true exit } if
+      } forall { pop //true exit } if
     } if
-    pop false exit
+    2 copy //false put             % Visited but not in the current chain.
+    pop //false exit
   } loop
   exch pop
 } bind def



More information about the gs-cvs mailing list