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

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Aug 10 20:57:32 PDT 2007


Author: alexcher
Date: 2007-08-10 20:57:31 -0700 (Fri, 10 Aug 2007)
New Revision: 8183

Modified:
   trunk/gs/lib/pdf_base.ps
Log:
Change stream keyword handling to accommodate yet another kind of a broken PDF.
Bug 689400, customer 580.

DETAILS:
Valid stream keyword can be followed by (\n) or (\r\n). Invalid PDF files
accepted by Acrobat Reader can insert blank characters or terminate the stream
with (\r). Old code tolerated ( \r) termination, but didn't tolerate ( \r\n).
New code assumes blank characters and (\r) termination at the same time are not
probable and tolerates ( \r\n) or (\r) but not ( \r).

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_base.ps
===================================================================
--- trunk/gs/lib/pdf_base.ps	2007-08-10 08:15:58 UTC (rev 8182)
+++ trunk/gs/lib/pdf_base.ps	2007-08-11 03:57:31 UTC (rev 8183)
@@ -739,14 +739,19 @@
       dup /File PDFfile put
       % make sure that we are just past the EOL \n character
       PDFfile dup fileposition 1 sub setfileposition	% back up one
-      { PDFfile read pop dup 13 eq {
-	  % If there had been a \n, token would have advanced over it
-	  % thus, if the terminator was \r, we have a format error!
-	  (   **** Warning: stream operator not terminated by valid EOL.\n) pdfformaterror
-	  pop exit	% fileposition is OK (just past the \r).
-	} if 
-	10 eq { exit } if
-      } loop	% scan past \n
+
+      PDFfile read pop
+      dup 13 eq {
+        % If there had been a \n, token would have advanced over it
+	% thus, if the terminator was \r, we have a format error!
+	(   **** Warning: stream operator not terminated by valid EOL.\n) pdfformaterror
+	pop   % fileposition is OK (just past the \r).
+      } {
+        % Otherwise, scan past \n
+        { 10 eq { exit } if
+          PDFfile read pop
+        } loop
+      } ifelse   
       dup /FilePosition PDFfile fileposition put
       PDFDEBUG {
         PDFSTEPcount 1 le {



More information about the gs-cvs mailing list