[poppler] poppler/Parser.cc
Adrian Johnson
ajohnson at kemper.freedesktop.org
Fri Jan 4 02:58:27 PST 2013
poppler/Parser.cc | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
New commits:
commit bef2c42f381c74fdb8bbb43babe1a93a0e229fb0
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Thu Jan 3 15:27:36 2013 +1030
Parser: return error if stream encountered when allowStreams = false
Opening a PDF file where the first object is a stream prints a
"Command token too long" error message. This is caused by the
Linearization check in Linearization::Linearization reading objects
with allowStreams = false. The Parser ignores the "stream" token and
tries reading the next token which is usually binary data. Setting
allowStreams to true will not work since the stream length is often an
indirect object and at this point the XRef has not been created.
Fix this by making Parser return an error object if the "stream" token
is encountered when allowStreams is false.
Bug 58966
diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index 5b80293..431a279 100644
--- a/poppler/Parser.cc
+++ b/poppler/Parser.cc
@@ -125,14 +125,14 @@ Object *Parser::getObj(Object *obj, GBool simpleOnly,
}
// stream objects are not allowed inside content streams or
// object streams
- if (allowStreams && buf2.isCmd("stream")) {
- if ((str = makeStream(obj, fileKey, encAlgorithm, keyLength,
- objNum, objGen, recursion + 1,
- strict))) {
- obj->initStream(str);
+ if (buf2.isCmd("stream")) {
+ if (allowStreams && (str = makeStream(obj, fileKey, encAlgorithm, keyLength,
+ objNum, objGen, recursion + 1,
+ strict))) {
+ obj->initStream(str);
} else {
- obj->free();
- obj->initError();
+ obj->free();
+ obj->initError();
}
} else {
shift();
More information about the poppler
mailing list