projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
474af7a
)
fixed accessing array out of bounds
author
Holger Schemel
<info@artsoft.org>
Thu, 20 Oct 2022 16:40:57 +0000
(18:40 +0200)
committer
Holger Schemel
<info@artsoft.org>
Thu, 20 Oct 2022 16:40:57 +0000
(18:40 +0200)
This issue was found by using Clang with option "-fsanitize=undefined".
src/game.c
patch
|
blob
|
history
diff --git
a/src/game.c
b/src/game.c
index 97617bb336003beddee02f2b2f1d37b73ea81d49..3a2c1a11db4b5bf290f038fe0124b6d59faaf6a2 100644
(file)
--- 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];