[Scummvm-git-logs] scummvm master -> 4d3f05ae7928ba625f29749b73b754314bdbe728

csnover csnover at users.noreply.github.com
Sat Dec 2 02:42:18 CET 2017


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:
4d3f05ae79 SCUMM: Fix array overflow writing var when no current script is set


Commit: 4d3f05ae7928ba625f29749b73b754314bdbe728
    https://github.com/scummvm/scummvm/commit/4d3f05ae7928ba625f29749b73b754314bdbe728
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-12-01T19:39:30-06:00

Commit Message:
SCUMM: Fix array overflow writing var when no current script is set

This situation is triggered normally when _currentScript is 0xFF,
but it could potentially also happen if _currentScript is some
other number >= NUM_SCRIPT_SLOT, so the check is a bit more
conservative than it might appear to need to be.

Changed paths:
    engines/scumm/script.cpp


diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index c9b37d4..36a5fdb 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -651,7 +651,7 @@ void ScummEngine::writeVar(uint var, int value) {
 
 		_scummVars[var] = value;
 
-		if ((_varwatch == (int)var) || (_varwatch == 0)) {
+		if ((_varwatch == (int)var || _varwatch == 0) && _currentScript < NUM_SCRIPT_SLOT) {
 			if (vm.slot[_currentScript].number < 100)
 				debug(1, "vars[%d] = %d (via script-%d)", var, value, vm.slot[_currentScript].number);
 			else





More information about the Scummvm-git-logs mailing list