[poppler] poppler/Stream.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue May 22 22:24:24 UTC 2018


 poppler/Stream.cc |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 58e056c4b15f262b7715f8061d6885eb80044d0d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed May 23 00:23:19 2018 +0200

    Revert 31c3832b996acbf04ea833e304d7d21ac4533a57
    
    So shifting left negative values is undefined behaviour according to the
    spec but if we don't do it we break, so we seem to be depending on this
    undefined behaviour, will try to figure out a better fix

diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index b6bfd838..4f075c12 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -1445,9 +1445,7 @@ int LZWStream::getCode() {
   while (inputBits < nextBits) {
     if ((c = str->getChar()) == EOF)
       return EOF;
-    if (likely(inputBuf >= 0)) {
-        inputBuf = (inputBuf << 8) | (c & 0xff);
-    }
+    inputBuf = (inputBuf << 8) | (c & 0xff);
     inputBits += 8;
   }
   code = (inputBuf >> (inputBits - nextBits)) & ((1 << nextBits) - 1);


More information about the poppler mailing list