Skip to content
Snippets Groups Projects

Fix use-after-free when Metal Sonic charges energy balls

Merged Hanicef requested to merge Hanicef/SRB2Classic:metal-sonic-use-after-free into next

During the battle with Metal Sonic, there's a chance that the game crashes when Metal Sonic charges his energy balls. This happens during the charging process, when the energy balls are absorbed into him and is about to fire. In that case, the energy balls are deallocated once they get close enough to Metal Sonic, but due to a missing check, the game still proceeds to run the energy ball logic even after they're are removed from memory, thus crashing the game.

I have also noticed that this always happens in debug mode, so you can easily verify this by just building the game with DEBUGMODE=1. Without this patch, the Metal Sonic fight always crashes when he charges, but behaves as intended with this patch.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading