aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormd52011-05-12 12:52:12 +0300
committermd52011-05-12 12:52:12 +0300
commit35086fe17cb2fee7fc4b91fa720031840d2f2c28 (patch)
treea7cf0c79b1989595b2505e8dd27af3cf8891459d
parent33b1ca2b080e661f3d04e22ac7a1bd658a66ea80 (diff)
downloadscummvm-rg350-35086fe17cb2fee7fc4b91fa720031840d2f2c28.tar.gz
scummvm-rg350-35086fe17cb2fee7fc4b91fa720031840d2f2c28.tar.bz2
scummvm-rg350-35086fe17cb2fee7fc4b91fa720031840d2f2c28.zip
SCI: Fixed bugs #3299458 and #3295849
-rw-r--r--engines/sci/engine/gc.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 2d71878bda..9c580dd8dc 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -87,7 +87,8 @@ static void processWorkList(SegManager *segMan, WorklistManager &wm, const Commo
wm._worklist.pop_back();
if (reg.segment != stackSegment) { // No need to repeat this one
debugC(kDebugLevelGC, "[GC] Checking %04x:%04x", PRINT_REG(reg));
- if (reg.segment < heap.size() && heap[reg.segment]) {
+ // We only check for valid offsets here. Fixes bugs #3299458 and #3295849.
+ if (reg.segment < heap.size() && heap[reg.segment] && heap[reg.segment]->isValidOffset(reg.offset)) {
// Valid heap object? Find its outgoing references!
wm.pushArray(heap[reg.segment]->listAllOutgoingReferences(reg));
}