poppler/Lexer.cc |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 582153b68e076c0f2ae71392f7553181c466e849
Author: Albert Astals Cid <aa...@kde.org>
Date:   Mon Jan 8 23:34:13 2018 +0100

    Lexer: Check curStr is actually a Stream before doing Stream operations
    
    Bug #104518

diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc
index 70e00539..3089da38 100644
--- a/poppler/Lexer.cc
+++ b/poppler/Lexer.cc
@@ -97,12 +97,14 @@ Lexer::Lexer(XRef *xrefA, Object *obj) {
   strPtr = 0;
   if (streams->getLength() > 0) {
     curStr = streams->get(strPtr);
-    curStr.streamReset();
+    if (curStr.isStream()) {
+      curStr.streamReset();
+    }
   }
 }
 
 Lexer::~Lexer() {
-  if (!curStr.isNone()) {
+  if (curStr.isStream()) {
     curStr.streamClose();
   }
   if (freeArray) {
@@ -120,7 +122,7 @@ int Lexer::getChar(GBool comesFromLook) {
   }
 
   c = EOF;
-  while (!curStr.isNone() && (c = curStr.streamGetChar()) == EOF) {
+  while (curStr.isStream() && (c = curStr.streamGetChar()) == EOF) {
     if (comesFromLook == gTrue) {
       return EOF;
     } else {
@@ -128,8 +130,10 @@ int Lexer::getChar(GBool comesFromLook) {
       curStr = Object();
       ++strPtr;
       if (strPtr < streams->getLength()) {
-        curStr = streams->get(strPtr);
-        curStr.streamReset();
+       curStr = streams->get(strPtr);
+       if (curStr.isStream()) {
+         curStr.streamReset();
+       }
       }
     }
   }
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to