From 0e34cec17a6fbd8944c485929b6746e18ce56913 Mon Sep 17 00:00:00 2001 From: Retro-Junk Date: Wed, 25 Jan 2017 01:48:00 +0300 Subject: CRYO: Fix out of bounds access in cursor save/restore --- engines/cryo/eden.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(x - 4, 0, 640 - 48); + y = CLIP(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--;) -- cgit v1.2.3