From 70e7f9f853ea8f8be03102404fe9475ab120dc47 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 2 Jan 2019 16:35:23 +0200 Subject: [PATCH] - added missing range checks to level compatibility handler # Conflicts: # src/compatibility.cpp --- src/compatibility.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 5817fc7fa..87be1c395 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -361,10 +361,13 @@ DEFINE_ACTION_FUNCTION(DLevelCompatibility, OffsetSectorPlane) PARAM_INT(planeval); PARAM_FLOAT(delta); - sector_t *sec = &level.sectors[sector]; - secplane_t& plane = sector_t::floor == planeval? sec->floorplane : sec->ceilingplane; - plane.ChangeHeight(delta); - sec->ChangePlaneTexZ(planeval, delta); + if ((unsigned)sector < level.sectors.Size()) + { + sector_t *sec = &level.sectors[sector]; + secplane_t& plane = sector_t::floor == planeval? sec->floorplane : sec->ceilingplane; + plane.ChangeHeight(delta); + sec->ChangePlaneTexZ(planeval, delta); + } return 0; } @@ -381,7 +384,11 @@ DEFINE_ACTION_FUNCTION(DLevelCompatibility, AddSectorTag) PARAM_PROLOGUE; PARAM_INT(sector); PARAM_INT(tag); - tagManager.AddSectorTag(sector, tag); + + if ((unsigned)sector < level.sectors.Size()) + { + tagManager.AddSectorTag(sector, tag); + } return 0; }