aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRetro-Junk2017-01-25 01:48:00 +0300
committerEugene Sandulenko2017-01-25 22:42:26 +0100
commit0e34cec17a6fbd8944c485929b6746e18ce56913 (patch)
tree29569c525de8894732e788d2003226ca614fdc0e
parent59212d9270265045690bf5a83dc7d87242dfa281 (diff)
downloadscummvm-rg350-0e34cec17a6fbd8944c485929b6746e18ce56913.tar.gz
scummvm-rg350-0e34cec17a6fbd8944c485929b6746e18ce56913.tar.bz2
scummvm-rg350-0e34cec17a6fbd8944c485929b6746e18ce56913.zip
CRYO: Fix out of bounds access in cursor save/restore
-rw-r--r--engines/cryo/eden.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index baf0dcd473..2c075c69f3 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -1103,7 +1103,9 @@ void EdenGame::useBank(int16 bank) {
void EdenGame::sundcurs(int16 x, int16 y) {
byte *keep = _cursKeepBuf;
- _cursKeepPos = Common::Point(x - 4, y - 4);
+ x = CLIP<int16>(x - 4, 0, 640 - 48);
+ y = CLIP<int16>(y - 4, 0, 200 - 48);
+ _cursKeepPos = Common::Point(x, y);
byte *scr = _mainViewBuf + _cursKeepPos.x + _cursKeepPos.y * 640;
for (int16 h = 48; h--;) {
for (int16 w = 48; w--;)