[Major Feature] Atheris coverage-guided fuzzing harness for Python API #283

Open
opened 2026-03-08 03:19:59 +00:00 by john · 0 comments
Owner

Context

The 7DRL 2026 post-mortem found 22 memory safety bugs, most of which require specific input sequences to trigger (entity cross-grid transfer, holding references across mutations, etc.). The existing test suite exercises normal operation paths and misses these edge cases entirely — ASan found 0 bugs when run against the full test suite, but immediately found the gridstate overflow when given a targeted trigger.

Coverage-guided fuzzing would systematically explore these edge cases.

Proposal

Create tests/fuzz/ with Atheris-based fuzz targets:

  1. Grid/Entity fuzz target: Random sequences of grid creation, entity append/remove/transfer, position changes, visibility updates
  2. Collection fuzz target: Random insert/remove/slice operations on UICollection and UIEntityCollection
  3. Property fuzz target: Random get/set of properties on UI objects with varying types
  4. Animation fuzz target: Random animation creation, callback registration, stepping

Each target creates mcrfpy objects and performs random operations, letting ASan catch any memory corruption.

Prerequisites

  • Clang build (see #282)
  • Atheris pip package
  • ASan-instrumented build (make asan)
  • #258–#278 (the bugs fuzzing should find)
  • #279 (memory safety audit meta-issue)
## Context The 7DRL 2026 post-mortem found 22 memory safety bugs, most of which require specific input sequences to trigger (entity cross-grid transfer, holding references across mutations, etc.). The existing test suite exercises normal operation paths and misses these edge cases entirely — ASan found 0 bugs when run against the full test suite, but immediately found the gridstate overflow when given a targeted trigger. Coverage-guided fuzzing would systematically explore these edge cases. ## Proposal Create `tests/fuzz/` with Atheris-based fuzz targets: 1. **Grid/Entity fuzz target**: Random sequences of grid creation, entity append/remove/transfer, position changes, visibility updates 2. **Collection fuzz target**: Random insert/remove/slice operations on UICollection and UIEntityCollection 3. **Property fuzz target**: Random get/set of properties on UI objects with varying types 4. **Animation fuzz target**: Random animation creation, callback registration, stepping Each target creates mcrfpy objects and performs random operations, letting ASan catch any memory corruption. ## Prerequisites - Clang build (see #282) - Atheris pip package - ASan-instrumented build (`make asan`) ## Related - #258–#278 (the bugs fuzzing should find) - #279 (memory safety audit meta-issue)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#283
No description provided.