From 8e6d888502506e061241f2cdeb7c3f76d4dfb04f Mon Sep 17 00:00:00 2001 From: Alex Cherepanov Date: Sun, 2 Oct 2011 22:26:58 -0400 Subject: 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. --- gs/Resource/Init/pdf_base.ps | 6 ++++-- gs/Resource/Init/pdf_main.ps | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'gs/Resource') diff --git a/gs/Resource/Init/pdf_base.ps b/gs/Resource/Init/pdf_base.ps index b542559bc..6b730e18c 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 d7db61b35..903949d2d 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 { % pdfopenfile 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 -- cgit v1.2.3