[poppler] Branch 'poppler-0.24' - poppler/Lexer.cc poppler/Lexer.h poppler/Parser.cc poppler/Parser.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Fri Nov 15 10:33:34 PST 2013
poppler/Lexer.cc | 4 ++--
poppler/Lexer.h | 2 +-
poppler/Parser.cc | 11 ++++-------
poppler/Parser.h | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
New commits:
commit ebe49d597a62aa94601c2e4595dbad1895ea7ef0
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Nov 15 19:33:00 2013 +0100
Fix regression in broken endstream detection
Rregression was caused by e1ffa9100cf6b4a444be7ed76b11698a5c5bb441
Fixes bug #70854
diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc
index bd7546f..55f8e48 100644
--- a/poppler/Lexer.cc
+++ b/poppler/Lexer.cc
@@ -581,7 +581,7 @@ Object *Lexer::getObj(Object *obj, int objNum) {
return obj;
}
-Object *Lexer::getObj(Object *obj, const char *cmdA) {
+Object *Lexer::getObj(Object *obj, const char *cmdA, int objNum) {
char *p;
int c;
GBool comment;
@@ -591,7 +591,7 @@ Object *Lexer::getObj(Object *obj, const char *cmdA) {
comment = gFalse;
const char *cmd1 = tokBuf;
*tokBuf = 0;
- while (strcmp(cmdA, cmd1)) {
+ while (strcmp(cmdA, cmd1) && (objNum < 0 || xref->getNumEntry(getPos()) == objNum)) {
while (1) {
if ((c = getChar()) == EOF) {
return obj->initEOF();
diff --git a/poppler/Lexer.h b/poppler/Lexer.h
index d9c23dc..8a14c6b 100644
--- a/poppler/Lexer.h
+++ b/poppler/Lexer.h
@@ -57,7 +57,7 @@ public:
// Get the next object from the input stream.
Object *getObj(Object *obj, int objNum = -1);
- Object *getObj(Object *obj, const char *cmdA);
+ Object *getObj(Object *obj, const char *cmdA, int objNum);
// Skip to the beginning of the next line in the input stream.
void skipToNextLine();
diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index 0370564..6f83c84 100644
--- a/poppler/Parser.cc
+++ b/poppler/Parser.cc
@@ -242,7 +242,7 @@ Stream *Parser::makeStream(Object *dict, Guchar *fileKey,
// refill token buffers and check for 'endstream'
shift(); // kill '>>'
- shift("endstream"); // kill 'stream'
+ shift("endstream", objNum); // kill 'stream'
if (buf1.isCmd("endstream")) {
shift();
} else {
@@ -250,9 +250,6 @@ Stream *Parser::makeStream(Object *dict, Guchar *fileKey,
if (strict) return NULL;
if (xref) {
// shift until we find the proper endstream or we change to another object or reach eof
- while (!buf1.isCmd("endstream") && xref->getNumEntry(lexer->getPos()) == objNum && !buf1.isEOF()) {
- shift("endstream");
- }
length = lexer->getPos() - pos;
if (buf1.isCmd("endstream")) {
obj.initInt64(length);
@@ -303,7 +300,7 @@ void Parser::shift(int objNum) {
lexer->getObj(&buf2, objNum);
}
-void Parser::shift(const char *cmdA) {
+void Parser::shift(const char *cmdA, int objNum) {
if (inlineImg > 0) {
if (inlineImg < 2) {
++inlineImg;
@@ -321,8 +318,8 @@ void Parser::shift(const char *cmdA) {
if (inlineImg > 0) {
buf2.initNull();
} else if (buf1.isCmd(cmdA)) {
- lexer->getObj(&buf2, -1);
+ lexer->getObj(&buf2, objNum);
} else {
- lexer->getObj(&buf2, cmdA);
+ lexer->getObj(&buf2, cmdA, objNum);
}
}
diff --git a/poppler/Parser.h b/poppler/Parser.h
index 9702716..d86e511 100644
--- a/poppler/Parser.h
+++ b/poppler/Parser.h
@@ -75,7 +75,7 @@ private:
int objNum, int objGen, int recursion,
GBool strict);
void shift(int objNum = -1);
- void shift(const char *cmdA);
+ void shift(const char *cmdA, int objNum);
};
#endif
More information about the poppler
mailing list