aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2010-10-25 03:37:24 +0000
committerSven Hesse2010-10-25 03:37:24 +0000
commitd751212eb34808ff77c6ceebea9b61f2e1ff0812 (patch)
tree21d349bec9952513de9e482ac05a0cc12ee11b60 /engines/gob
parent3b66f3d9200e7f80e42d5bd9c1b103b78ab7a48f (diff)
downloadscummvm-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/gob')
-rw-r--r--engines/gob/map.h12
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;