From 64d673ee2b6655f0ade45a3329ee08e32522b3c4 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 20 Oct 2022 18:40:57 +0200 Subject: [PATCH] fixed accessing array out of bounds This issue was found by using Clang with option "-fsanitize=undefined". --- src/game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 97617bb3..3a2c1a11 100644 --- a/src/game.c +++ b/src/game.c @@ -1784,7 +1784,7 @@ static void InitPlayerField(int x, int y, int element, boolean init_game) player->active = TRUE; // remove potentially duplicate players - if (StorePlayer[jx][jy] == Tile[x][y]) + if (IN_LEV_FIELD(jx, jy) && StorePlayer[jx][jy] == Tile[x][y]) StorePlayer[jx][jy] = 0; StorePlayer[x][y] = Tile[x][y]; -- 2.34.1