summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-12-31 17:30:11 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-12-31 17:30:11 +0100
commita9bf0fa97e00dd2d53bc24935178808851e7b478 (patch)
tree4f5b5d15a37ee66fd7bdc6d25128132a2e0353fb /src
parentfixed some bugs (saves might be broken though) (diff)
parentFix UB in ProjectileInfo.cpp (diff)
downloadre3-a9bf0fa97e00dd2d53bc24935178808851e7b478.tar
re3-a9bf0fa97e00dd2d53bc24935178808851e7b478.tar.gz
re3-a9bf0fa97e00dd2d53bc24935178808851e7b478.tar.bz2
re3-a9bf0fa97e00dd2d53bc24935178808851e7b478.tar.lz
re3-a9bf0fa97e00dd2d53bc24935178808851e7b478.tar.xz
re3-a9bf0fa97e00dd2d53bc24935178808851e7b478.tar.zst
re3-a9bf0fa97e00dd2d53bc24935178808851e7b478.zip
Diffstat (limited to 'src')
-rw-r--r--src/weapons/ProjectileInfo.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp
index 754da5f7..0930756c 100644
--- a/src/weapons/ProjectileInfo.cpp
+++ b/src/weapons/ProjectileInfo.cpp
@@ -159,8 +159,12 @@ CProjectileInfo::AddProjectile(CEntity *entity, eWeaponType weapon, CVector pos,
}
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++;
-
+#endif
if (i == ARRAY_SIZE(gaProjectileInfo))
return false;