summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Cherepanov <alex.cherepanov@artifex.com>2011-05-17 15:29:53 -0400
committerAlex Cherepanov <alex.cherepanov@artifex.com>2011-05-17 15:39:20 -0400
commitcbe9dcfc93812aae26ffd5c2bebbe5b2dc1a4623 (patch)
treeed8830e9467f66cf896d19783f909cd2497c8150
parent784c8aa262a2a71659ce2d882c424e0254368a10 (diff)
downloadghostpdl-cbe9dcfc93812aae26ffd5c2bebbe5b2dc1a4623.tar.gz
Bug 692209: tolerate missing /Length in PDF stream.
Add branches that deal with a missing /Length attribute in the PDF string directory. The sample file misspells /Length as /Lenght but the patch addresses a more general problem.
-rw-r--r--gs/Resource/Init/pdf_base.ps21
1 files changed, 12 insertions, 9 deletions
diff --git a/gs/Resource/Init/pdf_base.ps b/gs/Resource/Init/pdf_base.ps
index 22b52cae7..994717e23 100644
--- a/gs/Resource/Init/pdf_base.ps
+++ b/gs/Resource/Init/pdf_base.ps
@@ -822,8 +822,10 @@ currentdict /no_debug_dict undef
% may have preceded the EOL, such as spaces or tabs. Thus we back up one
% character and scan until we find the \n terminator.
/stream { % <dict> stream <modified_dict>
- dup /Length oget 0 eq {
- dup /Filter undef % don't confuse any filters that require data
+ dup /Length knownoget {
+ 0 eq {
+ dup /Filter undef % don't confuse any filters that require data
+ } if
} if
dup /F known dup PDFsource PDFfile eq or {
not {
@@ -853,14 +855,15 @@ currentdict /no_debug_dict undef
% Some (bad) PDf files have invalid stream lengths. This causes problems
% if we reposition beyond the end of the file. So we compare the given
% length to number of bytes left in the file.
- dup /Length oget
- dup PDFfile bytesavailable lt { % compare to to bytes left in file
- PDFfile fileposition % reposition to the end of stream
- add PDFfile exch setfileposition
- } {
- pop % bad stream length - do not reposition.
+ dup /Length knownoget {
+ dup PDFfile bytesavailable lt { % compare to to bytes left in file
+ PDFfile fileposition % reposition to the end of stream
+ add PDFfile exch setfileposition
+ } {
+ pop % bad stream length - do not reposition.
% This will force a length warning below
- } ifelse
+ } ifelse
+ } if
} {
pop
% We're already reading from a stream, which we can't reposition.