- Fixed heap use after free issue with lights.

This commit is contained in:
Edoardo Prezioso 2016-12-26 10:39:03 +01:00 committed by Christoph Oelckers
parent be508bc670
commit 3f7c057f92

View file

@ -599,7 +599,6 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &opos, subsector_t *subSe
for (unsigned i = 0; i < collected_ss.Size(); i++)
{
subSec = collected_ss[i].sub;
auto &pos = collected_ss[i].pos;
touching_subsectors = AddLightNode(&subSec->lighthead, subSec, this, touching_subsectors);
if (subSec->sector->validcount != ::validcount)
@ -608,9 +607,10 @@ void ADynamicLight::CollectWithinRadius(const DVector3 &opos, subsector_t *subSe
subSec->sector->validcount = ::validcount;
}
for (unsigned int i = 0; i < subSec->numlines; i++)
for (unsigned int j = 0; j < subSec->numlines; ++j)
{
seg_t * seg = subSec->firstline + i;
auto &pos = collected_ss[i].pos;
seg_t *seg = subSec->firstline + j;
// check distance from x/y to seg and if within radius add this seg and, if present the opposing subsector (lather/rinse/repeat)
// If out of range we do not need to bother with this seg.