Bug 688695 - run together endobj and next object fails
Summary: run together endobj and next object fails
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: All MacOS X
: P2 enhancement
Assignee: Ray Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-14 05:55 UTC by Tor Andersson
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer: 580
Word Size: ---


Attachments
corrupt pdf file that used to work (47.00 KB, application/pdf)
2006-05-14 06:01 UTC, Tor Andersson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Andersson 2006-05-14 05:55:12 UTC
The PDF parser has become more strict about a kind of corruption
where the endobj keyword is run together
with the following object number. Here is an excerpt from
a PDF file:

>> ^M>> ^Mendobj75 0 obj  <</Length 76 0 R /Filter /FlateDecode >>  stream^Mx~\

This kind of corrupt PDF used to work in 8.51 but causes an
Error: /undefined in /BXlevel in 8.53 and HEAD.
Comment 1 Tor Andersson 2006-05-14 06:01:42 UTC
Created attachment 2192 [details]
corrupt pdf file that used to work

objects that are written in the second 'update' are sometimes run together.
for instance, the first instance of object 1 0 is fine, but the second instance
is
missing whitespace after the endobj keyword.
Comment 2 Tor Andersson 2006-05-14 06:06:41 UTC
GS 8.51 does not crash, but does complain about the file having errors,
and does not use any of the objects that were added in the incremental
update that introduced the corruption.
Comment 3 Ray Johnston 2006-05-17 09:44:15 UTC
Change priority to P2 (customer level). 
Comment 4 Ray Johnston 2006-05-17 13:04:55 UTC
Change committed to allow yet another broken PDF that Acrobat Reader handles
without griping to be handled by Ghostscript. YUK!

--- lib/pdf_base.ps     (revision 6779)
+++ lib/pdf_base.ps     (revision 6781)
@@ -165,7 +165,14 @@
     dup dup dup /true eq exch /false eq or exch /null eq or {
       exch pop exch pop //systemdict exch get
     } {
-      .pdftokenerror
+      % Hackish fix to detect missing whitespace after "endobj". Yet another
+      % problem that (you guessed it!) Adobe Acrobat ignores silently
+      256 string cvs (endobj) anchorsearch {
+        (   **** Missing whitespace after 'endobj'.\n) pdfformaterror
+        exch pop cvn get exch pop exec
+      } {
+        .pdftokenerror
+      } ifelse
     } ifelse
   } ifelse
 } bind def