Microsoft FORGE Lab examines memory-safety flaws in Rust’s foundational core and standard libraries, where unsafe internals can undermine guarantees exposed through safe APIs. Using its AI-assisted Hyenas research system alongside manual investigation, the team reproduced bugs, assessed their impact, and reported them to Rust maintainers. The findings cluster around three misplaced assumptions: that code will not panic, that user-provided implementations will behave correctly, and that operating-system state will remain trustworthy. The focus is on unsound library code, not compiler flaws; two reported issues were still open at publication.
A panic-safety example occurs when a buffer is created with uninitialized slots before calling an element’s user-defined clone method: if cloning panics, cleanup treats uninitialized memory as valid values. The proposed remedy is to keep incomplete structures from being dropped until their invariants hold. Other examples show a custom allocator unwinding through code that assumes allocation cannot panic, and a safe string-pattern implementation causing replacement to produce invalid UTF-8, later enabling undefined behavior. Related bugs involve repeated user-controlled borrows and searchers whose results are applied to the wrong string. The authors recommend validating or storing callback results, encoding assumptions in types, and making traits unsafe when implementors must uphold safety conditions. They also argue that system-boundary assumptions, involving signals, memory mappings, or shared environment state, are becoming practical targets for AI-assisted research.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.