4. Safety and the known bug classes

perennial@0.1.0Updated 1 min readView as markdown

Each advisory against the target family becomes a negative test in tests/advisories/. The trigger patterns are described in docs/spec/advisories.md (written by the spec agent from the advisory texts); the tests are written from that description, not from any source.

Advisory Bug class Our test
RUSTSEC-2026-0251 / -0255 (sized-chunks) a panic in user code during a chunk operation leaves slots that are dropped twice or read after drop user types whose Clone, Ord, Hash, Eq and Drop panic on the n-th call, for every n up to the operation's call count, on every mutating method of all five collections; each element carries a live counter, and the test asserts every element is dropped at most once and the collection still satisfies its invariants (or was left unchanged) after catch_unwind
RUSTSEC-2023-0126 (im OrdSet aliasing) a mutation through one handle is visible through a clone clone, mutate each handle with every mutating method, and compare both against independent std models; run under Miri in CI
RUSTSEC-2026-0250 / -0248 (unmaintained) not a code defect the release pipeline, CI, dependabot and SECURITY.md are the answer

Rules that make the classes impossible by construction

  • #![forbid(unsafe_code)] in every crate; CI greps that the attribute is present.
  • No manual memory management; all node storage is Vec/arrayvec (permissive, audited).
  • User callbacks (Ord::cmp, Hash::hash, Clone::clone) are never called while a node is in a half-moved state that our own code would later drop: edits build the new node contents first, then swap them in.
  • Drop of a deep structure is iterative, not recursive, so dropping a huge Vector or map cannot overflow the stack (tested with 10⁷ elements in a thread with a small stack).

Fuzzing

cargo fuzz targets drive a random sequence of operations against a std model for each collection, with and without panicking element types. CI runs each for a fixed time on every PR.