[Meta] Engine memory safety audit — 7DRL 2026 post-mortem #279
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#279
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
During 7DRL 2026 (Liber Noster), a heap buffer overflow was discovered when entities moved between grids of different sizes. The root cause was
UIEntity::set_grid()only resizinggridstatewhen it was empty (size() == 0), leading to out-of-bounds writes inupdateVisibility().A comprehensive audit of the engine revealed 20 bugs in the same family — buffer overflows, dangling pointers, reference leaks, and thread safety issues. This meta-issue tracks the full set.
Bug Inventory
Critical — Heap Buffer Overflow (gridstate resize)
All have the same root cause: gridstate not resized when entity moves to a different-sized grid.
EntityCollection.append()EntityCollection.extend()EntityCollection.insert()EntityCollection.__setitem__Critical — Dangling Pointers
entity.at()→ GridPointStategrid.at()→ GridPointHigh — Memory Leaks & NULL Derefs
Medium — Races, Dangling Pointers, Iterator Safety
Fix Strategy
Consolidation Opportunity
The gridstate resize bugs (#258-#263, #276, #278) could be fixed with a single helper function:
Called from every grid-transfer entry point and at the top of
updateVisibility()andat().All 20 bugs (#258–#278) are now fixed. The final three dangling pointer issues (#270, #271, #277) were resolved in commit
2f4928cby nulling parent_grid pointers in GridData::~GridData(). Closing this meta issue.