aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2009-12-29 22:26:09 +0000
committerMartin Kiewitz2009-12-29 22:26:09 +0000
commitc992cd018c4d31dff86cf9cfa19f5f7ac803d363 (patch)
tree1f85db56440dd412e234b0f88e14bc1c8991e878 /engines
parent3e5d8280fadb8cf98a181c65c08d0c43be7af912 (diff)
downloadscummvm-rg350-c992cd018c4d31dff86cf9cfa19f5f7ac803d363.tar.gz
scummvm-rg350-c992cd018c4d31dff86cf9cfa19f5f7ac803d363.tar.bz2
scummvm-rg350-c992cd018c4d31dff86cf9cfa19f5f7ac803d363.zip
SCI: returning back raw == 0, when script trying to access invalid memory
svn-id: r46720
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/segment.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 991a56a8cf..4b4ce491e5 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -264,10 +264,12 @@ SegmentRef LocalVariables::dereference(reg_t pointer) {
SegmentRef ret;
ret.isRaw = false; // reg_t based data!
ret.maxSize = (_locals.size() - pointer.offset/2) * 2;
- if (ret.maxSize > 0)
+ if (ret.maxSize > 0) {
ret.raw = (byte *)&_locals[pointer.offset/2];
- else
+ } else {
warning("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer));
+ ret.raw = 0;
+ }
return ret;
}