Skip to content

Commit 8f410e1

Browse files
committed
Fix an OOB error in arenas with checklines and spare tire karts
See #5536
1 parent 06fc57e commit 8f410e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/tracks/check_line.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
201201
int kart_index)
202202
{
203203
World* w = World::getWorld();
204+
// Battle mode does not use checklines, and spare tire karts
205+
// would trigger an OOB issue (see #5536)
206+
// TODO: Once compatibility doesn't matter, the sign variable
207+
// can be fully removed, see comment below.
208+
if (RaceManager::get()->isBattleMode())
209+
return false;
210+
204211
// Sign here is for old client (<= 1.2) in networking, it's not used
205212
// anymore now
206213
bool sign = new_pos.sideofPlane(m_check_plane[0].pointA,
@@ -242,6 +249,7 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
242249

243250
if (kart_index >= 0)
244251
{
252+
assert(kart_index < (int)m_previous_sign.size());
245253
m_previous_sign[kart_index] = sign;
246254
if (result)
247255
{

0 commit comments

Comments
 (0)