[Scummvm-git-logs] scummvm master -> 125ad9db6d07edcd006292f199083b55268277a7

sluicebox 22204938+sluicebox at users.noreply.github.com
Sat Aug 15 21:31:02 UTC 2020


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:
125ad9db6d SCI: Allow freed objects to be passed to kDoAvoider


Commit: 125ad9db6d07edcd006292f199083b55268277a7
    https://github.com/scummvm/scummvm/commit/125ad9db6d07edcd006292f199083b55268277a7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-08-15T14:28:43-07:00

Commit Message:
SCI: Allow freed objects to be passed to kDoAvoider

Fixes the witch's cave in early versions of KQ4

Changed paths:
    engines/sci/engine/kmovement.cpp


diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 7422980df8..2bcecd1db7 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -407,7 +407,11 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) {
 	reg_t avoider = argv[0];
 	int16 timesStep = argc > 1 ? argv[1].toUint16() : 1;
 
-	if (!s->_segMan->isHeapObject(avoider)) {
+	// Note: the avoider must be an object but it may already have been freed.
+	//  Avoid:doit calls kDoAvoider multiple times and any of these calls might
+	//  result in the avoider being disposed when invoking mover:doit.
+	//  This can happen in kq4 early when captured by a witch in room 57.
+	if (!s->_segMan->isObject(avoider)) {
 		error("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider));
 		return SIGNAL_REG;
 	}




More information about the Scummvm-git-logs mailing list