diff options
author | Colin Snover | 2017-11-19 12:46:21 -0600 |
---|---|---|
committer | Colin Snover | 2017-11-19 12:48:14 -0600 |
commit | 617497d09454694c8601c044613e56c75b777062 (patch) | |
tree | 2b29ca1c8b19ad0ea70c371cfae33a17e89cc85a | |
parent | d874208520746df2d73b775902e3269350e9ea40 (diff) | |
download | scummvm-rg350-617497d09454694c8601c044613e56c75b777062.tar.gz scummvm-rg350-617497d09454694c8601c044613e56c75b777062.tar.bz2 scummvm-rg350-617497d09454694c8601c044613e56c75b777062.zip |
SCI: Fix UB shifting negative integers
-rw-r--r-- | engines/sci/decompressor.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.cpp | 2 | ||||
-rw-r--r-- | engines/sci/resource.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/engines/sci/decompressor.cpp b/engines/sci/decompressor.cpp index ca2298e67e..158119fe86 100644 --- a/engines/sci/decompressor.cpp +++ b/engines/sci/decompressor.cpp @@ -89,7 +89,7 @@ uint32 Decompressor::getBitsLSB(int n) { // fetching more data to buffer if needed if (_nBits < n) fetchBitsLSB(); - uint32 ret = (_dwBits & ~((~0) << n)); + uint32 ret = (_dwBits & ~(0xFFFFFFFFU << n)); _dwBits >>= n; _nBits -= n; return ret; diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 6b18dce518..9c26d816a1 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -113,7 +113,7 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) { byte colorMapping[4]; int16 x, y; byte color; - int16 maskA, maskB; + uint16 maskA, maskB; byte *pOut; int16 heightWidth; diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index af2ff60d59..eb786bce03 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1805,7 +1805,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) { } } - addResource(resId, source, offset & (((~bMask) << 24) | 0xFFFFFF), 0, map->getLocationName()); + addResource(resId, source, offset & ((((byte)~bMask) << 24) | 0xFFFFFF), 0, map->getLocationName()); } } while (!fileStream->eos()); |