From 92cdec077d04b65e09a8602b5549efcb4fdf048c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Apr 2021 20:54:12 +0200 Subject: [PATCH] - fixed some bogus range checks in automap code. --- source/core/automap.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 187ca3bb1..370e48f77 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -428,9 +428,12 @@ void drawredlines(int cposx, int cposy, int czoom, int cang) for (j = startwall, wal = &wall[startwall]; j < endwall; j++, wal++) { int k = wal->nextwall; - if (k < 0 || k >= MAXWALLS) continue; + if (k < 0 || k >= numwalls) continue; - if (sector[wal->nextsector].ceilingz == z1 && sector[wal->nextsector].floorz == z2) + int s = wal->nextsector; + if (s < 0 || s >= numsectors) continue; + + if (sector[s].ceilingz == z1 && sector[s].floorz == z2) if (((wal->cstat | wall[wal->nextwall].cstat) & (16 + 32)) == 0) continue; if (ShowRedLine(j, i))