[Scummvm-git-logs] scummvm master -> 3a8fd9c86c2db308c962ea31755522779a8e4006
bluegr
bluegr at gmail.com
Sat Jun 26 05:54:33 UTC 2021
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:
3a8fd9c86c TOLTECS: Fix warnings for subscript is above array bounds.
Commit: 3a8fd9c86c2db308c962ea31755522779a8e4006
https://github.com/scummvm/scummvm/commit/3a8fd9c86c2db308c962ea31755522779a8e4006
Author: Fiodar (fedor4ever at users.noreply.github.com)
Date: 2021-06-26T08:54:30+03:00
Commit Message:
TOLTECS: Fix warnings for subscript is above array bounds.
engines/toltecs/script.cpp:527:10: warning: array subscript is above array bounds [-Warray-bounds]
warning("Getting unimplemented game variable %s (%d)", varNames[variable], variable);
Logging print garbage because array varNames[] has 22 elements.
Changed paths:
engines/toltecs/script.cpp
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index 69bc9579b9..95a8594a44 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -498,7 +498,10 @@ void ScriptInterpreter::execScriptFunction(uint16 index) {
}
int16 ScriptInterpreter::getGameVar(uint variable) {
- debug(2, "ScriptInterpreter::getGameVar(%d{%s})", variable, varNames[variable]);
+ if (variable > 21)
+ debug(2, "ScriptInterpreter::getGameVar(%d)", variable);
+ else
+ debug(2, "ScriptInterpreter::getGameVar(%d{%s})", variable, varNames[variable]);
switch (variable) {
case 0: return _vm->_mouseDisabled;
@@ -524,13 +527,16 @@ int16 ScriptInterpreter::getGameVar(uint variable) {
case 20: return _vm->_sceneHeight;
case 21: return _vm->_sceneWidth;
default:
- warning("Getting unimplemented game variable %s (%d)", varNames[variable], variable);
+ warning("Getting unimplemented game variable %d", variable);
return 0;
}
}
void ScriptInterpreter::setGameVar(uint variable, int16 value) {
- debug(2, "ScriptInterpreter::setGameVar(%d{%s}, %d)", variable, varNames[variable], value);
+ if (variable > 21)
+ debug(2, "ScriptInterpreter::setGameVar(%d, %d)", variable, value);
+ else
+ debug(2, "ScriptInterpreter::setGameVar(%d{%s}, %d)", variable, varNames[variable], value);
switch (variable) {
case 0:
@@ -596,9 +602,11 @@ void ScriptInterpreter::setGameVar(uint variable, int16 value) {
break;
case 1:
case 2:
- default:
warning("Setting unimplemented game variable %s (%d) to %d", varNames[variable], variable, value);
break;
+ default:
+ warning("Setting unimplemented game variable (%d) to %d", variable, value);
+ break;
}
}
More information about the Scummvm-git-logs
mailing list