suspendmanager: suspend unsafe machine deconstruction - #5945
Open
Alistair-Afton wants to merge 2 commits into
Open
Alistair-Afton wants to merge 2 commits into
Alistair-Afton wants to merge 2 commits into
Conversation
Contributor
Author
|
The gcc-11 leg failure is not from this change: DF's test suite reported all tests passing, then crashed at quit with |
Alistair-Afton
force-pushed
the
suspendmanager-machine-collapse
branch
from
September 17, 2026 21:33
1a58ccb to
3a71580
Compare
Reading parameters[1]/[2] without a size check was out-of-bounds UB when 'suspendmanager set' was invoked with fewer than two arguments. It happened to return CR_WRONG_USAGE on most toolchains, but the garbage read could match 'preventblocking' and break argument validation entirely (seen on the gcc-11 CI leg).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5777.
suspendmanagernow inspectsDestroyBuildingjobs: if removing a machine component would leave a connected component of its machine graph without any terrain-anchored node, the job is suspended with the new reason "Would collapse machinery". Deconstructions that leave every remaining component anchored proceed normally.Reason::DANGER_OF_COLLAPSEplus a union-find pass overmachine_nodestconnections that checks each surviving connected component for an anchorMachine-collapse semantics (verified in-game on 53.16)
world.buildings.check_machine_collapsetriggers a stability pass over all machines after a building removalisPowerSource()alone does not anchor: a lone waterwheel over open space collapsesTesting
test/plugins/suspendmanager.luacase fabricates a floor-anchored gear, hanging axle, and hanging gear chain, queues destroy jobs, runssuspendmanager now, and asserts the anchor's job is suspended while the endpoint's is not