From 8ff6a709fbe72bbd2d1ac53623558a2ed0e6c2a6 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 25 Jun 2010 16:04:37 +0000 Subject: SCI: when writing to a temp, check for segment 0xFFFF and remove it. This fixes a false-positive uninitialized read error in room 44 sq1 svn-id: r50269 --- engines/sci/engine/vm.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index fa97dcf718..3295406745 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -273,6 +273,13 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i } } + // If we are writing an uninitialized value into a temp, we remove the uninitialized segment + // this happens at least in sq1/room 44 (slot-machine), because a send is missing parameters, then + // those parameters are taken from uninitialized stack and afterwards they are copied back into temps + // if we don't remove the segment, we would get false-positive uninitialized reads later + if (type == VAR_TEMP && value.segment == 0xffff) + value.segment = 0; + r[index] = value; } } -- cgit v1.2.3