aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/saveload.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-08-26 22:44:17 -0400
committerMatthew Hoops2011-08-26 22:44:17 -0400
commit4a69dc13d92e82fff85dc5a3a923b74ced259ffa (patch)
tree8945cd3745fd65f28b043caf7b1beddbbce2b2a1 /engines/tinsel/saveload.cpp
parentad293b249e74dd1cfbdbd721d02145efbdaf9eca (diff)
parent5e174cbfe466dbbe8e5470b0a00de1481b986181 (diff)
downloadscummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.tar.gz
scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.tar.bz2
scummvm-rg350-4a69dc13d92e82fff85dc5a3a923b74ced259ffa.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/tinsel/saveload.cpp')
-rw-r--r--engines/tinsel/saveload.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 7a973ba4be..4ac172be43 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -154,8 +154,15 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
syncTime(s, hdr.dateTime);
int tmp = hdr.size - s.bytesSynced();
+
+ // NOTE: We can't use SAVEGAME_ID here when attempting to remove a saved game from the launcher,
+ // as there is no TinselEngine initialized then. This means that we can't check if this is a DW1
+ // or DW2 savegame in this case, but it doesn't really matter, as the saved game is about to be
+ // deleted anyway. Refer to bug #3387551.
+ bool correctID = _vm ? (hdr.id == SAVEGAME_ID) : (hdr.id == DW1_SAVEGAME_ID || hdr.id == DW2_SAVEGAME_ID);
+
// Perform sanity check
- if (tmp < 0 || hdr.id != SAVEGAME_ID || hdr.ver > CURRENT_VER || hdr.size > 1024)
+ if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
return false;
// Skip over any extra bytes
s.skip(tmp);