diff options
author | shfil <filip.gawin@zoho.com> | 2020-12-31 16:34:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-31 16:34:50 +0100 |
commit | d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4 (patch) | |
tree | 777ef6ea9aaa22239b24d7709289ee539f152142 /src/weapons | |
parent | fix UB (diff) | |
download | re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.tar re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.tar.gz re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.tar.bz2 re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.tar.lz re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.tar.xz re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.tar.zst re3-d11325cf0fd1aad2f9160e302d4ca3b1d70ab9b4.zip |
Diffstat (limited to 'src/weapons')
-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 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; |