poppler/Stream.cc |    6 +++---
 poppler/Stream.h  |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 1bc71245fa88dc23dc355f926f50f04896739fff
Author: Adam Reichold <[email protected]>
Date:   Sat May 26 11:54:41 2018 +0200

    LZWStream: make inputBuf unsigned
    
    since shifting negative numbers is undefined according to spec

diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index f701789f..5e5eb335 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -28,7 +28,7 @@
 // Copyright (C) 2012 Fabio D'Urso <[email protected]>
 // Copyright (C) 2012 Even Rouault <[email protected]>
 // Copyright (C) 2013, 2017, 2018 Adrian Johnson <[email protected]>
-// Copyright (C) 2013 Adam Reichold <[email protected]>
+// Copyright (C) 2013, 2018 Adam Reichold <[email protected]>
 // Copyright (C) 2013 Pino Toscano <[email protected]>
 // Copyright (C) 2015 Suzuki Toshiya <[email protected]>
 // Copyright (C) 2015 Jason Crain <[email protected]>
@@ -1445,10 +1445,10 @@ int LZWStream::getCode() {
   while (inputBits < nextBits) {
     if ((c = str->getChar()) == EOF)
       return EOF;
-    inputBuf = (inputBuf << 8) | (c & 0xff);
+    inputBuf = (inputBuf << 8) | static_cast<unsigned>(c & 0xff);
     inputBits += 8;
   }
-  code = (inputBuf >> (inputBits - nextBits)) & ((1 << nextBits) - 1);
+  code = static_cast<signed>((inputBuf >> (inputBits - nextBits)) & ((1 << 
nextBits) - 1));
   inputBits -= nextBits;
   return code;
 }
diff --git a/poppler/Stream.h b/poppler/Stream.h
index a3faccd9..841c87a8 100644
--- a/poppler/Stream.h
+++ b/poppler/Stream.h
@@ -24,7 +24,7 @@
 // Copyright (C) 2012, 2013 Fabio D'Urso <[email protected]>
 // Copyright (C) 2013, 2017 Adrian Johnson <[email protected]>
 // Copyright (C) 2013 Peter Breitenlohner <[email protected]>
-// Copyright (C) 2013 Adam Reichold <[email protected]>
+// Copyright (C) 2013, 2018 Adam Reichold <[email protected]>
 // Copyright (C) 2013 Pino Toscano <[email protected]>
 //
 // To see a description of the changes please see the Changelog file that
@@ -823,7 +823,7 @@ private:
   StreamPredictor *pred;       // predictor
   int early;                   // early parameter
   GBool eof;                   // true if at eof
-  int inputBuf;                        // input buffer
+  unsigned int inputBuf;       // input buffer
   int inputBits;               // number of bits in input buffer
   struct {                     // decoding table
     int length;
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to