Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
fix UB
  • Loading branch information
aap committed Dec 31, 2020
1 parent 80d15d1 commit d89d3db1261d3effdb774e2901a508cd45b9a197
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/weapons/Explosion.cpp
@@ -121,7 +121,12 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT
#endif

int n = 0;
#ifdef FIX_BUGS
while (n < ARRAY_SIZE(gaExplosion) && gaExplosion[n].m_nIteration != 0)
#else
// array overrun is UB
while (gaExplosion[n].m_nIteration != 0 && n < ARRAY_SIZE(gaExplosion))
#endif
n++;
if (n == ARRAY_SIZE(gaExplosion))
return false;

0 comments on commit d89d3db

Please sign in to comment.