{"id":"RUSTSEC-2026-0128","aliases":["RUSTSEC-2026-0128"],"related":[],"kind":"vulnerability","state":"published","title":"Double-free and use-after-free in `Keys::next()`","summary":"`Keys::next()` uses `ptr::read` to move out the `Option<V>` by value, which\ndrops the contained `V` when `V` is non-Copy (e.g. `String`). This leaves a\ndangling value in the map's storage slot. Subsequent `get()` operations on\nthat key return a dangling reference to already-freed memory.\n\nThis can be triggered through safe public APIs — `Map::keys()`,\n`Keys::next()`, and `Map::get()` — with no `unsafe` required from the\ncaller. Under Miri, accessing the freed slot produces \"Undefined Behavior:\npointer not dereferenceable: alloc has been freed, so this pointer is\ndangling\".","summaryFormat":"markdown","summarySource":"rustsec","descriptions":[{"lang":"en","text":"`Keys::next()` uses `ptr::read` to move out the `Option<V>` by value, which\ndrops the contained `V` when `V` is non-Copy (e.g. `String`). This leaves a\ndangling value in the map's storage slot. Subsequent `get()` operations on\nthat key return a dangling reference to already-freed memory.\n\nThis can be triggered through safe public APIs — `Map::keys()`,\n`Keys::next()`, and `Map::get()` — with no `unsafe` required from the\ncaller. Under Miri, accessing the freed slot produces \"Undefined Behavior:\npointer not dereferenceable: alloc has been freed, so this pointer is\ndangling\".","format":"markdown","source":"rustsec"}],"published":"2026-05-02T12:00:00.000Z","modified":"2026-05-13T12:30:06.615Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected"}],"ecosystem":"crates.io","package":"emap","purl":"pkg:cargo/emap","source":"rustsec"}],"references":[{"url":"https://crates.io/crates/emap","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0128.html","tags":["advisory"],"sources":["rustsec"]},{"url":"https://github.com/yegor256/emap/issues/168","tags":["report"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0128","url":"https://rustsec.org/advisories/RUSTSEC-2026-0128.html","licence":"CC0-1.0","modified":"2026-05-13T12:30:06.615Z"}],"updatedAt":"2026-11-25T22:56:43.349Z"}