diff options
author | Sven Hesse | 2010-10-25 03:37:24 +0000 |
---|---|---|
committer | Sven Hesse | 2010-10-25 03:37:24 +0000 |
commit | d751212eb34808ff77c6ceebea9b61f2e1ff0812 (patch) | |
tree | 21d349bec9952513de9e482ac05a0cc12ee11b60 /engines | |
parent | 3b66f3d9200e7f80e42d5bd9c1b103b78ab7a48f (diff) | |
download | scummvm-rg350-d751212eb34808ff77c6ceebea9b61f2e1ff0812.tar.gz scummvm-rg350-d751212eb34808ff77c6ceebea9b61f2e1ff0812.tar.bz2 scummvm-rg350-d751212eb34808ff77c6ceebea9b61f2e1ff0812.zip |
GOB: Add sanity checks to getPass()/setPass()
svn-id: r53788
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/map.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/gob/map.h b/engines/gob/map.h index 4a63e84a63..0593c663cc 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -152,6 +152,9 @@ public: if (!_passMap) return 0; + if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight)) + return 0; + return _passMap[y * _mapWidth + x]; } @@ -159,6 +162,9 @@ public: if (!_passMap) return; + if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight)) + return; + _passMap[y * _mapWidth + x] = pass; } @@ -184,6 +190,9 @@ public: if (!_passMap) return 0; + if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight)) + return 0; + if (heightOff == -1) heightOff = _passWidth; return _passMap[y * heightOff + x]; @@ -193,6 +202,9 @@ public: if (!_passMap) return; + if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight)) + return; + if (heightOff == -1) heightOff = _passWidth; _passMap[y * heightOff + x] = pass; |