aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWalter van Niftrik2009-05-12 14:58:44 +0000
committerWalter van Niftrik2009-05-12 14:58:44 +0000
commiteb8ddbe8f4d32b235209ab7a91cd5f1f3a67422d (patch)
tree0ac7d80618d3c217e4a24fd975c3ff7b580cea54 /engines
parentc59f9a9670c0bffd75cfa765d334b40a376982ec (diff)
downloadscummvm-rg350-eb8ddbe8f4d32b235209ab7a91cd5f1f3a67422d.tar.gz
scummvm-rg350-eb8ddbe8f4d32b235209ab7a91cd5f1f3a67422d.tar.bz2
scummvm-rg350-eb8ddbe8f4d32b235209ab7a91cd5f1f3a67422d.zip
SCI: Fixed a valgrind warning.
svn-id: r40492
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/seg_manager.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 59773e00c6..6e80133351 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -818,8 +818,8 @@ void SegManager::scriptRelocateExportsSci11(int seg) {
/* We are forced to use an ugly heuristic here to distinguish function
exports from object/class exports. The former kind points into the
script resource, the latter into the heap resource. */
- int location = READ_LE_UINT16((byte *)(scr->export_table + i));
- if (READ_LE_UINT16(scr->heap_start + location) == SCRIPT_OBJECT_MAGIC_NUMBER) {
+ uint16 location = READ_LE_UINT16((byte *)(scr->export_table + i));
+ if ((location < scr->heap_size - 1) && (READ_LE_UINT16(scr->heap_start + location) == SCRIPT_OBJECT_MAGIC_NUMBER)) {
WRITE_LE_UINT16((byte *)(scr->export_table + i), location + scr->heap_start - scr->buf);
} else {
// Otherwise it's probably a function export,