Fix integer overflow recursing through BSP for weather checks

This commit is contained in:
Gustaf Alhäll 2025-12-21 15:11:53 +01:00 committed by NepDisk
parent 18186a2fd7
commit 8da7bc7298
2 changed files with 4 additions and 4 deletions

View file

@ -12215,8 +12215,8 @@ void P_PrecipitationEffects(void)
closedist = SEARCHRADIUS*2;
#undef SEARCHRADIUS
for (y = yl; y <= yh; y += RADIUSSTEP)
for (x = xl; x <= xh; x += RADIUSSTEP)
for (y = yl; y >= yl && y <= yh; y += RADIUSSTEP)
for (x = xl; x >= xl && x <= xh; x += RADIUSSTEP)
{
if (R_PointInSubsectorFast((fixed_t)x, (fixed_t)y)->sector->ceilingpic != skyflatnum) // Found the outdoors!
continue;

View file

@ -1097,8 +1097,8 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
xl = listensource.x - 1024*FRACUNIT;
xh = listensource.x + 1024*FRACUNIT;
approx_dist = 1024*FRACUNIT;
for (y = yl; y <= yh; y += FRACUNIT*64)
for (x = xl; x <= xh; x += FRACUNIT*64)
for (y = yl; y >= yl && y <= yh; y += FRACUNIT*64)
for (x = xl; x >= xl && x <= xh; x += FRACUNIT*64)
{
if (R_PointInSubsectorFast(x, y)->sector->ceilingpic == skyflatnum)
{