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

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Feb 2 10:54:09 PST 2007


Author: alexcher
Date: 2007-02-02 10:54:09 -0800 (Fri, 02 Feb 2007)
New Revision: 7670

Modified:
   trunk/gs/lib/pdf_base.ps
   trunk/gs/lib/pdf_sec.ps
Log:
Move decryption filter past /SubFileDecode filter installed by
the /resolvestream procedure and remove redundant /SubFileDecode
filter before decryption. The latter didn't handle the case when
the stream length was incorrect. Bug 688722, customer 700.

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_base.ps
===================================================================
--- trunk/gs/lib/pdf_base.ps	2007-02-02 18:24:56 UTC (rev 7669)
+++ trunk/gs/lib/pdf_base.ps	2007-02-02 18:54:09 UTC (rev 7670)
@@ -913,24 +913,25 @@
 		% Stack: readdata? dict parms filternames
     2 index /File get exch
 		% Stack: readdata? dict parms file/string filternames
-    pdf_decrypt_stream		% add decryption if needed
     dup length 0 eq {
 		% All the PDF filters have EOD markers, but in this case
 		% there is no specified filter.
-      pop exch pop
-		% Stack: readdata? dict file/string
-      2 index 1 index type /filetype eq or {
+      exch dup type /filetype eq 5 index or {
               % Use length for any files or reading data from any source.
-        1 index /Length knownoget not { 0 } if
+        3 index /Length knownoget not { 0 } if
       } {
       0       % Otherwise length of 0 for whole string
       } ifelse
-      2 index /IDFlag known { pop } { () /SubFileDecode filter } ifelse
+      4 index /IDFlag known { pop } { () /SubFileDecode filter } ifelse
+      exch
+      pdf_decrypt_stream		% add decryption if needed
+      pop exch pop
     } {
                 % Stack: readdata? dict parms source filternames
       exch 3 index /Length knownoget {
         dup 0 ne { () /SubFileDecode filter } { pop } ifelse
       } if exch
+      pdf_decrypt_stream		% add decryption if needed
       applyfilters
     } ifelse
   } ifelse

Modified: trunk/gs/lib/pdf_sec.ps
===================================================================
--- trunk/gs/lib/pdf_sec.ps	2007-02-02 18:24:56 UTC (rev 7669)
+++ trunk/gs/lib/pdf_sec.ps	2007-02-02 18:54:09 UTC (rev 7670)
@@ -447,13 +447,6 @@
    {
       exch 
 	% Stack: readdata? dict parms filternames file/string
-      3 index /Length oget
-      dup 0 eq {
-	% Handle Length=0 case specially to avoid SubFileDecode semantics
-        pop pop ()
-      } {
-        () /SubFileDecode filter
-      } ifelse
       3 index /StreamKey get arc4decodefilter
       exch
    } if



More information about the gs-cvs mailing list