mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
After the first move_suffix in Root::split_off, the source and result trees share values through two temporarily invalid structures. If a later key comparison panics, unwinding leaves the map with a stale length over a partially detached tree, and consuming iteration then double-frees the shared values, reachable from safe code. Guard the descent loop with a mem::DropGuard that aborts on unwind, armed before the first move_suffix and dismissed once the borders are fixed.