From 0db71a197548648bf3575a641d59c11cf80ac7ca Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Mon, 15 Nov 2021 00:45:01 +0100 Subject: [PATCH] monster: add BUGFIX for MAI_Fallen, invalid out-of-bounds check The out-of-bounds check in MAI_Fallen checks whether the relative offset coordinates (x, y) are out of bounds, rather than the absoulte coordinate (xpos, ypos) which is used for array access into dMonster. --- Source/monster.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/monster.cpp b/Source/monster.cpp index 7c3209ade..d6b11f107 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4206,6 +4206,7 @@ void MAI_Fallen(int i) for (x = -rad; x <= rad; x++) { xpos = Monst->_mx + x; ypos = Monst->_my + y; + // BUGFIX: should check `xpos` and `ypos` for out-of-bounds, was checking `x` and `y`. if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) { m = dMonster[xpos][ypos]; if (m > 0) {