summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2013-01-03 15:27:36 +1030
committerAdrian Johnson <ajohnson@redneon.com>2013-01-04 21:20:00 +1030
commitbef2c42f381c74fdb8bbb43babe1a93a0e229fb0 (patch)
treea078662ceec5f446c1d2ed6b4286ed0059a05fb1
parent801f7feea79e5bc3b5417566552e4df1e6b8a51c (diff)
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
-rw-r--r--poppler/Parser.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index 5b80293b..431a279c 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();