[Scummvm-git-logs] scummvm master -> cb233df64d4266006ed82c5030b4307cbb4229ef

sluicebox noreply at scummvm.org
Wed Nov 8 03:48:03 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5cc1ac3a98 SCI: Initialize EngineState::_segMan
cb233df64d SCI: Fix errorString when execution stack isn't initialized


Commit: 5cc1ac3a98a97011a9e5a3fd69f6279d7e286594
    https://github.com/scummvm/scummvm/commit/5cc1ac3a98a97011a9e5a3fd69f6279d7e286594
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-07T20:47:30-07:00

Commit Message:
SCI: Initialize EngineState::_segMan

Destructor deletes a potentially uninitialized pointer

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


diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 6dacf274562..d4810ea2081 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -66,8 +66,9 @@ static const uint16 s_halfWidthSJISMap[256] = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
-EngineState::EngineState(SegManager *segMan)
-: _segMan(segMan),
+EngineState::EngineState(SegManager *segMan) :
+	_segMan(segMan),
+	_msgState(nullptr),
 	_dirseeker() {
 
 	reset(false);


Commit: cb233df64d4266006ed82c5030b4307cbb4229ef
    https://github.com/scummvm/scummvm/commit/cb233df64d4266006ed82c5030b4307cbb4229ef
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-07T20:47:31-07:00

Commit Message:
SCI: Fix errorString when execution stack isn't initialized

Changed paths:
    engines/sci/sci.cpp


diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 0e2f3a228d6..118721d9d5d 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -718,7 +718,17 @@ void SciEngine::runGame() {
 // When the SCI engine enters an error state, this block will add additional VM engine context for error reporting
 void SciEngine::errorString(const char *buf_input, char *buf_output, int buf_output_size) {
 	EngineState *s = _gamestate;
-	Script *activeScript = (s && s->_segMan) ? s->_segMan->getScriptIfLoaded(s->xs->addr.pc.getSegment()) : nullptr;
+	Script *activeScript = nullptr;
+	if (s != nullptr) {
+		// EngineState::xs is only valid if it points to an item in the execution stack.
+		Common::List<ExecStack>::const_iterator it;
+		for (it = s->_executionStack.begin(); it != s->_executionStack.end(); ++it) {
+			if (&(*it) == s->xs) {
+				activeScript = s->_segMan->getScriptIfLoaded(s->xs->addr.pc.getSegment());
+				break;
+			}
+		}
+	}
 	Kernel *kernel = g_sci ? g_sci->getKernel() : nullptr;
 
 	// If a script is actively loaded at the time of error.




More information about the Scummvm-git-logs mailing list