[Scummvm-git-logs] scummvm master -> ff237e81e194822c8774b49072e3638ff8cd64fa

athrxx noreply at scummvm.org
Sat Oct 26 00:26:08 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ff237e81e1 KYRA: (EOB) - fix invalid mem access


Commit: ff237e81e194822c8774b49072e3638ff8cd64fa
    https://github.com/scummvm/scummvm/commit/ff237e81e194822c8774b49072e3638ff8cd64fa
Author: athrxx (athrxx at scummvm.org)
Date: 2024-10-26T02:25:15+02:00

Commit Message:
KYRA: (EOB) - fix invalid mem access

This is an original bug which is present like that in all versions,
including SegaCD. The script processor passes the monster pos
as a direction argument which is nonsense and can also be out
of range.

Changed paths:
    engines/kyra/engine/scene_rpg.cpp
    engines/kyra/script/script_eob.cpp


diff --git a/engines/kyra/engine/scene_rpg.cpp b/engines/kyra/engine/scene_rpg.cpp
index a92a08bdb57..5a99bd09f04 100644
--- a/engines/kyra/engine/scene_rpg.cpp
+++ b/engines/kyra/engine/scene_rpg.cpp
@@ -340,6 +340,7 @@ bool KyraRpgEngine::checkSceneUpdateNeed(int block) {
 
 uint16 KyraRpgEngine::calcNewBlockPosition(uint16 curBlock, uint16 direction) {
 	static const int16 blockPosTable[] = { -32, 1, 32, -1 };
+	assert(direction < ARRAYSIZE(blockPosTable));
 	return (curBlock + blockPosTable[direction]) & 0x3FF;
 }
 
diff --git a/engines/kyra/script/script_eob.cpp b/engines/kyra/script/script_eob.cpp
index 377daa3ae91..8cb400c2697 100644
--- a/engines/kyra/script/script_eob.cpp
+++ b/engines/kyra/script/script_eob.cpp
@@ -390,7 +390,7 @@ int EoBInfProcessor::oeob_movePartyOrObject(int8 *data) {
 		for (int i = 0; i < 30; i++) {
 			if (_vm->_monsters[i].block != c)
 				continue;
-			_vm->placeMonster(&_vm->_monsters[i], d, _vm->_monsters[i].pos);
+			_vm->placeMonster(&_vm->_monsters[i], d, _vm->_monsters[i].dir);
 		}
 		debugC(5, kDebugLevelScript, "         - move monsters on block '0x%.04X' to block '0x%.04X'", c, d);
 




More information about the Scummvm-git-logs mailing list