Skip to content

ASAN Fixes - #295

Open
Causeless wants to merge 2 commits into
developmentfrom
ai-battle-crash-fixes
Open

Causeless wants to merge 2 commits into
developmentfrom
ai-battle-crash-fixes

Conversation

@Causeless

Copy link
Copy Markdown
Contributor

Two fixes for memory errors that turned up while running headless AI battles on the deterministic-sim branch.

  • Sound channels were left using a destroyed SoundContainer
  • EquipShieldInBGArm could result in the device being simultanesouly considered held and in the inventory, and on death it would be released to MovableMan twice and therefore deleted twice

🤖 Generated with Claude Code

Causeless and others added 2 commits October 12, 2026 12:52
… was destroyed

A SoundContainer that gets destroyed while its sounds are playing leaves
them to play out, which emitters for one count on for their burst and end
sounds. The channels playing them kept pointing at the destroyed
SoundContainer though, and it then got used every update for the channels'
3D effects, and once more when the sounds ended. AddressSanitizer reports
these as uses after free.

Destroying a SoundContainer now unties its channels from it. Sounds that
loop endlessly get stopped instead, since there'd be nothing left to stop
them with, and the ones left to play out stay the way they were, with
their 3D effects no longer updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uipping it

When told to put what the BG arm was holding at the front of the inventory,
it went on to use the place it had found the device at before doing so,
which by then was the place of the item in front of it. That item got taken
out of the inventory instead, never to be seen again, and the device ended
up both held and in the inventory. Its holder dying then dropped it twice
over, which left MovableMan with it in its list of items twice, and the
game deleting it twice when quitting.

Lua could get this on any call, since its binding cast the function to one
without that argument, which left the argument as whatever happened to be
in its place. It is bound through an adapter now, which leaves the argument
at its default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant