Skip to content

Commit

Permalink
GLK: Fix off-by-one memory read
Browse files Browse the repository at this point in the history
The for loop shouldn't check previous entity on the first iteration
  • Loading branch information
lephilousophe authored and dreammaster committed Jul 7, 2019
1 parent da7ed2d commit 1c87f42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engines/glk/alan2/alan2.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 1c87f42

Please sign in to comment.