[Bugfix] bad-free in GridData::computeFOV / ~GridData via ColorLayer.draw_fov (ASan) #321
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#321
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
AddressSanitizer reports a bad-free / mismatched-ownership double-free in the FOV map managed by
GridData. The FOV map is allocated withmallocand freed withfreeinsideGridData::computeFOV, butGridData::~GridDatalater callsoperator deleteon a pointer that was already freed (or a TCOD-owned pointer), corrupting the heap.Found by the #312 fuzz campaign (
fuzz_fovtarget, newColorLayer.draw_fovTier C op). Severity: HIGH (memory corruption, not just UB).ASan output (abridged)
Analysis
GridData::computeFOV(src/GridData.cpp:155) both allocates and frees a buffer (TCOD FOV map) with Cmalloc/free. The same/related pointer is thenoperator delete-d inGridData::~GridData(src/GridData.cpp:59). Either the destructor double-frees a pointercomputeFOValready released, or itdeletes memory that wasmalloc-ed (mismatched allocator). Thedraw_fovpath makes the lifetime issue observable.Repro
This one is iteration-state-dependent — single-input replay does not reliably trigger it; re-run the campaign:
Minimized crashing input (base64), for reference:
Suggested labels
Bugfix,system:grid,priority:tier1-active(apply via web — MCP label bug)Related: #312 (fuzz coverage that found this), #283.