From f2afd88633e36c6a0bf70f323cbb884fc2846bb5 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Tue, 29 Oct 2019 21:19:42 +0000 Subject: [PATCH] Fix OOBs in DRLG_L5Subs (#402) Refs #396 --- Source/drlg_l1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 93e989425..f4e422cf7 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1278,15 +1278,15 @@ static void DRLG_L5Subs() rv--; } - // BUGFIX: Add `&& y > 0` to the if statement. - if (i == 89) { + // BUGFIX: Add `&& y > 0` to the if statement. (fixed) + if (i == 89 && y > 0) { if (L5BTYPES[dungeon[x][y - 1]] != 79 || L5dflags[x][y - 1]) i = 79; else dungeon[x][y - 1] = 90; } - // BUGFIX: Add `&& x + 1 < DMAXX` to the if statement. - if (i == 91) { + // BUGFIX: Add `&& x + 1 < DMAXX` to the if statement. (fixed) + if (i == 91 && x + 1 < DMAXX) { if (L5BTYPES[dungeon[x + 1][y]] != 80 || L5dflags[x + 1][y]) i = 80; else