[poppler] poppler/Stream.cc poppler/Stream.h

Albert Astals Cid aacid at kemper.freedesktop.org
Sat May 26 09:55:33 UTC 2018


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

New commits:
commit 1bc71245fa88dc23dc355f926f50f04896739fff
Author: Adam Reichold <adam.reichold at t-online.de>
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 <fabiodurso at hotmail.it>
 // Copyright (C) 2012 Even Rouault <even.rouault at mines-paris.org>
 // Copyright (C) 2013, 2017, 2018 Adrian Johnson <ajohnson at redneon.com>
-// Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
+// Copyright (C) 2013, 2018 Adam Reichold <adamreichold at myopera.com>
 // Copyright (C) 2013 Pino Toscano <pino at kde.org>
 // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
 // Copyright (C) 2015 Jason Crain <jason at aquaticape.us>
@@ -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 <fabiodurso at hotmail.it>
 // Copyright (C) 2013, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Peter Breitenlohner <peb at mppmu.mpg.de>
-// Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
+// Copyright (C) 2013, 2018 Adam Reichold <adamreichold at myopera.com>
 // Copyright (C) 2013 Pino Toscano <pino at kde.org>
 //
 // 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;


More information about the poppler mailing list