[Scummvm-cvs-logs] SF.net SVN: scummvm: [31570] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Apr 19 15:58:32 CEST 2008


Revision: 31570
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31570&view=rev
Author:   lordhoto
Date:     2008-04-19 06:58:32 -0700 (Sat, 19 Apr 2008)

Log Message:
-----------
Added some asserts to prevent out of bounds access.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/script_tim.h

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2008-04-19 13:52:09 UTC (rev 31569)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2008-04-19 13:58:32 UTC (rev 31570)
@@ -35,7 +35,7 @@
 #define COMMAND_UNIMPL() { 0, 0 }
 	static CommandEntry commandProcs[] = {
 		// 0x00
-		COMMAND(cmd_restartFunc0),
+		COMMAND(cmd_startFunc0Now),
 		COMMAND(cmd_stopCurFunc),
 		COMMAND_UNIMPL(),
 		COMMAND_UNIMPL(),
@@ -199,7 +199,7 @@
 	return (this->*_commands[cmd].proc)(param);
 }
 
-int TIMInterpreter::cmd_restartFunc0(const uint16 *param) {
+int TIMInterpreter::cmd_startFunc0Now(const uint16 *param) {
 	_currentTim->func[0].ip = _currentTim->func[0].avtl;
 	_currentTim->func[0].lastTime = _system->getMillis();
 	return 1;
@@ -215,6 +215,7 @@
 
 int TIMInterpreter::cmd_initFunc(const uint16 *param) {
 	uint16 func = *param;
+	assert(func < 10);
 	if (_currentTim->func[func].avtl)
 		_currentTim->func[func].ip = _currentTim->func[func].avtl;
 	else
@@ -224,6 +225,7 @@
 
 int TIMInterpreter::cmd_stopFunc(const uint16 *param) {
 	uint16 func = *param;
+	assert(func < 10);
 	_currentTim->func[func].ip = 0;
 	return 1;
 }
@@ -253,6 +255,7 @@
 
 int TIMInterpreter::cmd_initFuncNow(const uint16 *param) {
 	uint16 func = *param;
+	assert(func < 10);
 	_currentTim->func[func].ip = _currentTim->func[func].avtl;
 	_currentTim->func[func].lastTime = _currentTim->func[func].nextTime = _system->getMillis();
 	return 1;
@@ -260,6 +263,7 @@
 
 int TIMInterpreter::cmd_stopFuncNow(const uint16 *param) {
 	uint16 func = *param;
+	assert(func < 10);
 	_currentTim->func[func].ip = 0;
 	_currentTim->func[func].lastTime = _currentTim->func[func].nextTime = _system->getMillis();
 	return 1;

Modified: scummvm/trunk/engines/kyra/script_tim.h
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.h	2008-04-19 13:52:09 UTC (rev 31569)
+++ scummvm/trunk/engines/kyra/script_tim.h	2008-04-19 13:58:32 UTC (rev 31570)
@@ -86,7 +86,7 @@
 	const CommandEntry *_commands;
 	int _commandsSize;
 
-	int cmd_restartFunc0(const uint16 *param);
+	int cmd_startFunc0Now(const uint16 *param);
 	int cmd_stopCurFunc(const uint16 *param);
 	int cmd_initFunc(const uint16 *param);
 	int cmd_stopFunc(const uint16 *param);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list