diff options
author | shfil <filip.gawin@zoho.com> | 2020-12-31 16:33:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-31 16:33:34 +0100 |
commit | 9938d04ca797ab2ad28c86ce0d446aa65782ca67 (patch) | |
tree | 136f1579296970691976405a0569416a4cf8532e | |
parent | fix UB (diff) | |
download | re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.tar re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.tar.gz re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.tar.bz2 re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.tar.lz re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.tar.xz re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.tar.zst re3-9938d04ca797ab2ad28c86ce0d446aa65782ca67.zip |
-rw-r--r-- | src/weapons/ProjectileInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp index b56e3a29..da00b87a 100644 --- a/src/weapons/ProjectileInfo.cpp +++ b/src/weapons/ProjectileInfo.cpp @@ -128,8 +128,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; |