From c657588658cf00b50024d973d67401c2a57652b4 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 26 Jan 2012 21:57:51 +0000 Subject: [PATCH] Fix a potential sector[-1] access when drawing a masked wall in Polymost. git-svn-id: https://svn.eduke32.com/eduke32@2280 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymost.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 96d755d80..124bf92bb 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -4550,6 +4550,10 @@ void polymost_drawrooms() numscans = numbunches = 0; + // MASKWALL_BAD_ACCESS + // Fixes access of stale maskwall[maskwallcnt] (a "scan" index, in BUILD lingo): + maskwallcnt = 0; + if (globalcursectnum >= MAXSECTORS) globalcursectnum -= MAXSECTORS; else @@ -4624,6 +4628,11 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) z = maskwall[damaskwallcnt]; wal = &wall[thewall[z]]; wal2 = &wall[wal->point2]; sectnum = thesector[z]; sec = §or[sectnum]; + +// if (wal->nextsector < 0) return; + // Without MASKWALL_BAD_ACCESS fix: + // wal->nextsector is -1, WGR2 SVN Lochwood Hollow (Til' Death L1) (or trueror1.map) + nsec = §or[wal->nextsector]; z1 = max(nsec->ceilingz,sec->ceilingz); z2 = min(nsec->floorz,sec->floorz);