From be0f092ff7ec7d56b6d00b398c2bfdb0a1d5beb3 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 29 Oct 2019 21:41:46 +0000 Subject: [PATCH] Fix OOB in M_CheckEFlag --- Source/monster.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/monster.cpp b/Source/monster.cpp index d07ff87e7..eeab1a85a 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1208,6 +1208,12 @@ void M_CheckEFlag(int i) x = monster[i]._mx - 1; y = monster[i]._my + 1; + + if (x < 0 || y >= MAXDUNY) { + monster[i]._meflag = FALSE; + return; + } + f = 0; m = dpiece_defs_map_2[x][y].mt; if (m >= dpiece_defs_map_2[0][0].mt) {