A_PointyThink Throws Segfault
In file src/p_enemy.c, A_PointyThink
will throw a segfault if a player happens to respawn near a Pointy. This is caused by actor->lastlook
being a -1 during an update tick, which breaks the following lines:
fa = actor->lastlook+i;
v[0] = FixedMul(FINECOSINE(fa),radius);
v[1] = 0;
v[2] = FixedMul(FINESINE(fa),radius);
v[3] = FRACUNIT;
fa (angle_t / UINT32) is ends up as a negative value, which results in a segfault when passed to FixedMul(FINECOSINE(fa),radius);
. This may not be consistent on all platforms, I only have a Mac to test this on. Regardless, I've attached a patch that fixes this (function returns if actor->lastlook is < 0. Also a small bit of minor cleanup.
This is most apparent with this addon (specifically, Nightlight Gully): https://mb.srb2.org/addons/the-cyberdime-realm-virtual-simplicity.188/
Edited by SleepyAli