From c86bf550a5dd97670aaae50cb21d97a4034e885e Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 10 May 2013 12:31:35 +0000 Subject: [PATCH] Mapster32 corruptcheck: if some members out of MAX bounds, signal level 5. git-svn-id: https://svn.eduke32.com/eduke32@3744 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 4 +++- polymer/eduke32/source/astub.c | 27 ++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 530e85188..cfc20e9b9 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -8058,7 +8058,9 @@ int32_t LoadBoard(const char *filename, uint32_t flags) char msgtail[64]; const int32_t ci = CheckMapCorruption(4, 0); - if (ci >= 4) + if (ci == 5) + Bstrcpy(msgtail, "^12(EXTREME corruption)"); + else if (ci == 4) Bstrcpy(msgtail, "^12(HEAVY corruption)"); else if (i > 0) Bsprintf(msgtail, "^14(removed %d sprites)", i); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 0ab3faf5d..d69f6dc89 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -11623,7 +11623,12 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing) numw = sector[i].wallnum; if (w0 < 0 || w0 > numwalls) - CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw); + { + if (w0 < 0 || w0 >= MAXWALLS) + CORRUPTCHK_PRINT(5, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d INVALID!!!", i, w0); + else + CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw); + } if (w0 != ewall) CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d inconsistent, expected %d", i, w0, ewall); @@ -11695,12 +11700,24 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing) ns = wall[j].nextsector; if (nw >= numwalls) - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of range: numwalls=%d", - j, nw, numwalls); + { + if (nw >= MAXWALLS) + CORRUPTCHK_PRINT(5, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d INVALID!!!", + j, nw); + else + CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of range: numwalls=%d", + j, nw, numwalls); + } if (ns >= numsectors) - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d", - j, ns, numsectors); + { + if (ns >= MAXSECTORS) + CORRUPTCHK_PRINT(5, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d INVALID!!!", + j, ns); + else + CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d", + j, ns, numsectors); + } if (nw>=w0 && nw<=endwall) CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL is its own sector's wall", j);