mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 20:40:47 +00:00
exhumed: fix overflow in feebtag()
This commit is contained in:
parent
22e0c4d9ae
commit
9a2c2d5a98
1 changed files with 11 additions and 3 deletions
|
@ -408,13 +408,21 @@ void feebtag(int x, int y, int z, int nSector, short *nSprite, int nVal2, int nV
|
|||
|
||||
if (nStat >= 900 && !(sprite[i].cstat & 0x8000))
|
||||
{
|
||||
int xDiff = sprite[i].x - x;
|
||||
int yDiff = sprite[i].y - y;
|
||||
uint32_t xDiff = klabs(sprite[i].x - x);
|
||||
uint32_t yDiff = klabs(sprite[i].y - y);
|
||||
int zDiff = sprite[i].z - z;
|
||||
|
||||
if (zDiff < 5120 && zDiff > -25600)
|
||||
{
|
||||
int theSqrt = ksqrt(xDiff * xDiff + yDiff * yDiff);
|
||||
uint32_t diff = xDiff * xDiff + yDiff * yDiff;
|
||||
|
||||
if (diff > INT_MAX)
|
||||
{
|
||||
OSD_Printf("%s %d: overflow\n", EDUKE32_FUNCTION, __LINE__);
|
||||
diff = INT_MAX;
|
||||
}
|
||||
|
||||
int theSqrt = ksqrt(diff);
|
||||
|
||||
if (theSqrt < nVal3 && ((nStat != 950 && nStat != 949) || !(var_14 & 1)) && ((nStat != 912 && nStat != 913) || !(var_20 & 2)))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue