diff options
author | Paul Gilbert | 2014-03-13 00:26:19 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-03-13 00:26:19 -0400 |
commit | e80373c823215c8d1ac59a6a1a81dc9233b1eb07 (patch) | |
tree | 14cb3a6f20d2caa706c870d40bed5b2886586e9a /engines | |
parent | 0df4d0aed1678f81cb75bb56cb2a1fc19603312c (diff) | |
download | scummvm-rg350-e80373c823215c8d1ac59a6a1a81dc9233b1eb07.tar.gz scummvm-rg350-e80373c823215c8d1ac59a6a1a81dc9233b1eb07.tar.bz2 scummvm-rg350-e80373c823215c8d1ac59a6a1a81dc9233b1eb07.zip |
MADS: Add guard against reading depth value outside bounds of depth surface
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/msurface.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 2adb3e5b81..e8d391ff89 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -497,12 +497,14 @@ MSurface *MSurface::flipHorizontal() const { /*------------------------------------------------------------------------*/ int DepthSurface::getDepth(const Common::Point &pt) { - if (_vm->_game->_scene._sceneInfo->_depthStyle == 2) { int bits = (3 - (pt.x % 4)) * 2; byte v = *getBasePtr(pt.x >> 2, pt.y); return v >> bits; } else { + if (pt.x < 0 || pt.y < 0 || pt.x >= this->w || pt.y >= this->h) + return 8; + return *getBasePtr(pt.x, pt.y) & 0xF; } } |