[gs-commits] ghostpdl branch, master, updated. ghostpdl-9.02-632-g8e6d888

Alex Cherepanov alexcher at ghostscript.com
Mon Oct 3 02:30:22 UTC 2011


The ghostpdl branch, master has been updated
       via  8e6d888502506e061241f2cdeb7c3f76d4dfb04f (commit)
      from  3380bef5e77ddfaa8aab496a4da13fd297480bd1 (commit)

----------------------------------------------------------------------
commit 8e6d888502506e061241f2cdeb7c3f76d4dfb04f
Author: Alex Cherepanov <alex.cherepanov at artifex.com>
Date:   Sun Oct 2 22:26:58 2011 -0400

    Bug 692560: read objects with invalid obj# as nulls.
    
    According to PDF spec, objects with invalid object numbers should
    be considered null objects. GS finally implements this.

diff --git a/gs/Resource/Init/pdf_base.ps b/gs/Resource/Init/pdf_base.ps
index b542559..6b730e1 100644
--- a/gs/Resource/Init/pdf_base.ps
+++ b/gs/Resource/Init/pdf_base.ps
@@ -758,8 +758,10 @@ currentdict /no_debug_dict undef
       (%Resolving: ) print 2 copy 2 array astore //== exec
     } if
   } if
-  1 index 0 lt {
-    (   **** Considering object with a negative number as null.\n) pdfformaterror
+  1 index dup 0 lt exch NumObjects ge or {
+    (   **** Considering object with an invalid number ) 
+    2 index 20 string cvs concatstrings   
+    ( as null.\n) concatstrings pdfformaterror
     pop pop //null
   } {
     1 index resolved? {           % If object has already been resolved ...
diff --git a/gs/Resource/Init/pdf_main.ps b/gs/Resource/Init/pdf_main.ps
index d7db61b..903949d 100644
--- a/gs/Resource/Init/pdf_main.ps
+++ b/gs/Resource/Init/pdf_main.ps
@@ -776,7 +776,7 @@ currentdict /xref-char-dict undef
 
 /pdfopenfile {		% <file> pdfopenfile <dict>
    pdfdict readonly pop		% can't do it any earlier than this
-   30 dict begin
+   31 dict begin
    /LocalResources 0 dict def
    /DefaultQstate //null def	% establish binding
    /Printed where { pop } {
@@ -851,6 +851,8 @@ currentdict /xref-char-dict undef
      } loop			% Loop to previous trailer
    } ifelse			% Ifelse readxref stopped
 
+   /NumObjects Objects llength def  % To check that obj# < NumObjects
+
    % Scan numbers in the range 2147483648..4294967295 in Encrypt dictionary
    % as unsigned integers for compatibility with Acrobat Reader. Bug 689010.
    << /PDFScanUnsigned //true >> setuserparams


Summary of changes:
 gs/Resource/Init/pdf_base.ps |    6 ++++--
 gs/Resource/Init/pdf_main.ps |    4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)



More information about the gs-commits mailing list