From: Holger Schemel Date: Thu, 20 Oct 2022 16:40:57 +0000 (+0200) Subject: fixed accessing array out of bounds X-Git-Tag: 4.3.3.0~45 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=64d673ee2b6655f0ade45a3329ee08e32522b3c4;p=rocksndiamonds.git fixed accessing array out of bounds This issue was found by using Clang with option "-fsanitize=undefined". --- 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];