diff options
author | Le Philousophe | 2019-07-07 09:52:54 +0200 |
---|---|---|
committer | Paul Gilbert | 2019-07-07 09:26:52 -0700 |
commit | 1c87f428d00d795297bdf8d4ef68eabf68a3e571 (patch) | |
tree | f46e5ae22d7655587a7bf5ab455bfbe2b316a3fa | |
parent | da7ed2d90614afa6a7e18bad8586b35d4a217d3e (diff) | |
download | scummvm-rg350-1c87f428d00d795297bdf8d4ef68eabf68a3e571.tar.gz scummvm-rg350-1c87f428d00d795297bdf8d4ef68eabf68a3e571.tar.bz2 scummvm-rg350-1c87f428d00d795297bdf8d4ef68eabf68a3e571.zip |
GLK: Fix off-by-one memory read
The for loop shouldn't check previous entity on the first iteration
-rw-r--r-- | engines/glk/alan2/alan2.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp index ccac7a6a02..d875deecb3 100644 --- a/engines/glk/alan2/alan2.cpp +++ b/engines/glk/alan2/alan2.cpp @@ -161,8 +161,11 @@ static void syncEventQueue(Common::Serializer &s) { EvtqElem *arr = eventq; if (s.isLoading()) { - for (i = 0; arr[i - 1].time != 0; ++i) + i = 0; + do { arr[i].synchronize(s); + i++; + } while (arr[i - 1].time != 0); etop = i - 1; } else { // Mark the top |