Fix potential (certain?) oob access with ST28/SE21.

Encountered with Scent.map.  Since the SE21 are deleted after they have
been used, the search for them in the ST28 code in sector.c may come up
empty, in which case sector[-1] would be accessed.

git-svn-id: https://svn.eduke32.com/eduke32@2377 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-02-21 19:32:55 +00:00
parent e18063beb8
commit 0f933a8522
2 changed files with 14 additions and 10 deletions

View file

@ -7123,7 +7123,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (klabs(*zptr-s->z) < 1024) if (klabs(*zptr-s->z) < 1024)
{ {
*zptr = s->z; *zptr = s->z;
KILLIT(i); //All done KILLIT(i); //All done // SE_21_KILLIT, see sector.c
} }
} }
else sc->extra--; else sc->extra--;

View file

@ -963,11 +963,13 @@ REDODOOR:
j = headspritesect[sn]; j = headspritesect[sn];
while (j >= 0) while (j >= 0)
{ {
if (sprite[j].statnum==3 && (sprite[j].lotag&0xff)==21) if (sprite[j].statnum==STAT_EFFECTOR && (sprite[j].lotag&0xff)==21)
break; //Found it break; //Found it
j = nextspritesect[j]; j = nextspritesect[j];
} }
if (j >= 0) // PK: The matching SE21 might have gone, see SE_21_KILLIT in actors.c
{
j = sprite[j].hitag; j = sprite[j].hitag;
l = headspritestat[STAT_EFFECTOR]; l = headspritestat[STAT_EFFECTOR];
@ -978,7 +980,9 @@ REDODOOR:
actor[l].t_data[0] = 1; actor[l].t_data[0] = 1;
l = nextspritestat[l]; l = nextspritestat[l];
} }
A_CallSound(sn,ii); A_CallSound(sn,ii);
}
return; return;
} }