diff options
author | Thierry Crozat | 2016-04-11 03:40:17 +0100 |
---|---|---|
committer | Thierry Crozat | 2016-04-11 03:40:17 +0100 |
commit | d4a747705fa06be9a02a0fea2c5705f421ddd516 (patch) | |
tree | 18347fbea6ec90e68b91bdf4680f30b9be3596a5 /engines/drascula | |
parent | a97f9d0ec6f0006add3d0a47f33074f1ee731b36 (diff) | |
download | scummvm-rg350-d4a747705fa06be9a02a0fea2c5705f421ddd516.tar.gz scummvm-rg350-d4a747705fa06be9a02a0fea2c5705f421ddd516.tar.bz2 scummvm-rg350-d4a747705fa06be9a02a0fea2c5705f421ddd516.zip |
DRASCULA: Fix random crash when loading pendulum scene savegame
When saving from the pendulum scene the curX and curY values are
negative while the curWidth and curHeight values are unset. This
causes random crashes as we may do an array out of bound access
when enterRoom() is called at the end of the load.
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/saveload.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index 9063fbc792..94c4e817ee 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -300,6 +300,16 @@ bool DrasculaEngine::loadGame(int slot) { if (!sscanf(currentData, "%d.ald", &roomNum)) { error("Bad save format"); } + + // When loading room 102 while being attached below the pendulum Some variables + // are not correctly set and can cause random crashes when calling enterRoom below. + // The crash occurs in moveCharacters() when accessing factor_red[curY + curHeight]. + if (roomNum == 102 && flags[1] == 2) { + curX = 103; + curY = 108; + curWidth = curHeight = 0; + } + enterRoom(roomNum); selectVerb(kVerbNone); |