check for wrong indexes in P_LoadSegs() (#918)

Fix 1killtng.wad map13
This commit is contained in:
Roman Fomin 2023-02-20 19:52:07 +07:00 committed by GitHub
parent ee3fff240a
commit 81b2f88822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,6 +211,14 @@ void P_LoadSegs (int lump)
ldef = &lines[linedef];
li->linedef = ldef;
side = SHORT(ml->side);
// Andrey Budko: check for wrong indexes
if ((unsigned)ldef->sidenum[side] >= (unsigned)numsides)
{
I_Error("P_LoadSegs: linedef %d for seg %d references a non-existent sidedef %d",
linedef, i, (unsigned)ldef->sidenum[side]);
}
li->sidedef = &sides[ldef->sidenum[side]];
li->frontsector = sides[ldef->sidenum[side]].sector;
// [FG] recalculate