Skip to content

Fix bad checking of values in setStartupBoost()#8

Merged
Alayan-stk-2 merged 1 commit intoAlayan-stk-2:BalanceSTK2from
Nomagno:BalanceSTK2-fix-startup
Sep 29, 2025
Merged

Fix bad checking of values in setStartupBoost()#8
Alayan-stk-2 merged 1 commit intoAlayan-stk-2:BalanceSTK2from
Nomagno:BalanceSTK2-fix-startup

Conversation

@Nomagno
Copy link

@Nomagno Nomagno commented Aug 19, 2025

This issue was caused by an oversight in the preconditions of f90c452.
The consequence was that, in online races, if a player didn't press anything during the start sequence, the boost_level value of 1, indicating a normal start with no penalties and no boosts, would get sent from the server to the clients. This would then be processed by Kart::setStartupBoost(uint8_t boost_level), which in fact had a wrong assert that treated a boost level of 1 as a valid value, when it instead resulted on an out-of-bounds memory access to the startup boost vectors when fed into the index formula, crashing every single client.
Fixed by adding an alternate scenario for when the boost level is < 2.

Agreement

By creating a pull request in stk-code, you hereby agree to dual-license your contribution as
GNU General Public License version 3 or any later version and
Mozilla Public License version 2 or any later version.

This includes your previous contribution(s) under the same name of contributor.

Keep the above statement in the pull request comment for agreement.

@Alayan-stk-2
Copy link
Owner

Thank you for the PR, I didn't see it earlier. The code seems straightforward enough, I'll check it when I have a bit of time for testing.

@Alayan-stk-2 Alayan-stk-2 merged commit e6ced1b into Alayan-stk-2:BalanceSTK2 Sep 29, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants