diff options
| author | Albert Astals Cid <aacid@kde.org> | 2013-11-15 19:33:00 +0100 |
|---|---|---|
| committer | Albert Astals Cid <aacid@kde.org> | 2013-11-15 19:33:00 +0100 |
| commit | ebe49d597a62aa94601c2e4595dbad1895ea7ef0 (patch) | |
| tree | 9fc8d024ce61bf0331671e57b96f4478157c3ff7 | |
| parent | f4a72fd3c61091d6b455af9a881c2390da19b506 (diff) | |
Fix regression in broken endstream detection
Rregression was caused by e1ffa9100cf6b4a444be7ed76b11698a5c5bb441
Fixes bug #70854
| -rw-r--r-- | poppler/Lexer.cc | 4 | ||||
| -rw-r--r-- | poppler/Lexer.h | 2 | ||||
| -rw-r--r-- | poppler/Parser.cc | 11 | ||||
| -rw-r--r-- | poppler/Parser.h | 2 |
4 files changed, 8 insertions, 11 deletions
diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc index bd7546f8..55f8e48a 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 d9c23dc8..8a14c6b1 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 03705640..6f83c843 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 97027164..d86e5115 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 |
