1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-10 20:29:15 +00:00

Fix UB in ProjectileInfo.cpp

This commit is contained in:
shfil 2020-12-31 16:34:50 +01:00 committed by GitHub
parent d89d3db126
commit d11325cf0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,8 +159,12 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
} }
int i = 0; int i = 0;
#ifdef FIX_BUGS
while (i < ARRAY_SIZE(gaProjectileInfo) && gaProjectileInfo[i].m_bInUse) i++;
#else
// array overrun is UB
while (gaProjectileInfo[i].m_bInUse && i < ARRAY_SIZE(gaProjectileInfo)) i++; while (gaProjectileInfo[i].m_bInUse && i < ARRAY_SIZE(gaProjectileInfo)) i++;
#endif
if (i == ARRAY_SIZE(gaProjectileInfo)) if (i == ARRAY_SIZE(gaProjectileInfo))
return false; return false;