[gs-cvs] rev 8040 - trunk/gs/lib
alexcher at ghostscript.com
alexcher at ghostscript.com
Sun Jun 10 13:12:02 PDT 2007
Author: alexcher
Date: 2007-06-10 13:12:02 -0700 (Sun, 10 Jun 2007)
New Revision: 8040
Modified:
trunk/gs/lib/pdf_main.ps
Log:
Fix processing of very small PDF files ( < 1024 bytes) that was broken by
rev. 7834 that increased the size of look-ahead buffer to 1024 bytes.
DIFFERENCES:
None.
Modified: trunk/gs/lib/pdf_main.ps
===================================================================
--- trunk/gs/lib/pdf_main.ps 2007-06-10 05:21:02 UTC (rev 8039)
+++ trunk/gs/lib/pdf_main.ps 2007-06-10 20:12:02 UTC (rev 8040)
@@ -79,7 +79,9 @@
} loop
exch pop
{
- dup 1023 string .peekstring { % "1024 string" exceeds current %stdin buffer"
+ dup 1023 string .peekstring pop dup length 400 ge {
+ % "1024 string" exceeds current %stdin buffer
+ % Valid PDF file cannot be smaller than 400 bytes.
(%PDF-1.) search {
3 1 roll pop pop
dup (%!PS) search not {
@@ -552,8 +554,9 @@
currentglobal true .setglobal globaldict begin
/TTFWarnList 0 dict def /UndefProcList 0 dict def
end .setglobal
- PDFfile dup 0 setfileposition pdfstring readstring
- not {/pdfopen cvx /syntaxerror signalerror} if
+ PDFfile dup 0 setfileposition
+ 0 () /SubFileDecode filter % to avoid file closure
+ pdfstring readstring pop
(%PDF-) search not {/pdfopen cvx /syntaxerror signalerror} if
length /PDFoffset exch def pop
% some badly formed PDF's (Visioneer) have something other than EOL
More information about the gs-cvs
mailing list