diff options
author | Colin Snover | 2016-07-30 10:55:00 -0500 |
---|---|---|
committer | Colin Snover | 2016-08-01 10:37:14 -0500 |
commit | 6d1f8e8c876983f22e94ba8966b02d8cc088d2a5 (patch) | |
tree | ccb48906190637eb0fc197951009041237e7633e /engines/sci/engine/gc.cpp | |
parent | 10f9cb7023e2f68d5489b6f73b46a6e541f86b72 (diff) | |
download | scummvm-rg350-6d1f8e8c876983f22e94ba8966b02d8cc088d2a5.tar.gz scummvm-rg350-6d1f8e8c876983f22e94ba8966b02d8cc088d2a5.tar.bz2 scummvm-rg350-6d1f8e8c876983f22e94ba8966b02d8cc088d2a5.zip |
SCI32: Fix invalid memory access after BitmapTable is extended
When new bitmaps are added and the underlying Common::Array needs
to move to expand, this invalidates all pointers to bitmaps, which
makes it basically impossible to use the bitmap segment since you
never know if a reference is going to be invalidated due to an
array move.
To solve this, BitmapTable is changed to hold pointers to
SciBitmaps that are allocated separately on the heap instead, so
when those bitmaps are looked up, the resulting pointers are valid
for the lifetime of the bitmap, instead of the lifetime of the
Common::Array used internally by BitmapTable.
Diffstat (limited to 'engines/sci/engine/gc.cpp')
-rw-r--r-- | engines/sci/engine/gc.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index ad4fd19405..6c1713bed9 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -160,7 +160,7 @@ AddrSet *findAllActiveReferences(EngineState *s) { BitmapTable *bt = static_cast<BitmapTable *>(heap[i]); for (uint j = 0; j < bt->_table.size(); j++) { - if (!bt->_table[j].data.getShouldGC()) { + if (bt->_table[j].data && bt->_table[j].data->getShouldGC() == false) { wm.push(make_reg(i, j)); } } |