[Scummvm-cvs-logs] scummvm master -> f70087dc90255166e9cd8cf38b80d34a3a4e6494

eriktorbjorn eriktorbjorn at telia.com
Wed May 1 07:38:11 CEST 2013


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:
f70087dc90 SCUMM: Fix out-of-bounds access in runScript() debug messages


Commit: f70087dc90255166e9cd8cf38b80d34a3a4e6494
    https://github.com/scummvm/scummvm/commit/f70087dc90255166e9cd8cf38b80d34a3a4e6494
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2013-04-30T22:33:05-07:00

Commit Message:
SCUMM: Fix out-of-bounds access in runScript() debug messages

I believe this fixes CID 1003954, 1003957, 1003958, 1003962 and
1003966.

Changed paths:
    engines/scumm/script.cpp



diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index d025ede..96c5514 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -49,6 +49,8 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in
 	if (!recursive)
 		stopScript(script);
 
+	uint16 number = (_currentScript != 0xFF) ? vm.slot[_currentScript].number : 0;
+
 	if (script < _numGlobalScripts) {
 		// Call getResourceAddress to ensure the resource is loaded & its usage count reset
 		/*scriptPtr =*/ getResourceAddress(rtScript, script);
@@ -56,7 +58,7 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in
 		scriptType = WIO_GLOBAL;
 
 		debugC(DEBUG_SCRIPTS, "runScript(Global-%d) from %d-%d", script,
-				       vm.slot[_currentScript].number, _roomResource);
+				       number, _roomResource);
 	} else {
 		scriptOffs = _localScriptOffsets[script - _numGlobalScripts];
 		if (scriptOffs == 0)
@@ -64,7 +66,7 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in
 		scriptType = WIO_LOCAL;
 
 		debugC(DEBUG_SCRIPTS, "runScript(%d) from %d-%d", script,
-				       vm.slot[_currentScript].number, _roomResource);
+				       number, _roomResource);
 	}
 
 	if (cycle == 0)






More information about the Scummvm-git-logs mailing list