Email me

Rust advisories / id-map

Vulnerability MediumRUSTSEC-2025-0050 · id-map

RUSTSEC-2025-0050: IdMap::from_iter may lead to uninitialized memory being freed on drop

Short answerA security vulnerability in the id-map crate: IdMap::from_iter may lead to uninitialized memory being freed on drop. GitHub rates it Medium. Fixed in 0.2.2: update to a fixed version.

Crateid-map
TypeVulnerability (memory-corruption)
Affected versionsFrom 0.1.6 before 0.2.2.
Fixed in0.2.2
SeverityMedium (GitHub rating)
Published2025-08-14
Last changed2025-10-28
Also known asGHSA-qq4c-hm99-979m
Affected functionsid_map::IdMap::from_iter

What to do

  1. See which version you have: cargo tree -i id-map (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p id-map. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example id-map = "0.2.2") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

Due to a flaw in the constructor id_map::IdMap::from_iter, ill-formed objects may be created in which the amount of actually initialized memory is less than what is expected by the fields of IdMap. Specifically, the field ids is initialized based on the capacity of the vector values, which is constructed from the provided iterator. However, the length of this vector may be smaller than its capacity.

In such cases, when the resulting IdMap is dropped, its destructor incorrectly assumes that values contains ids.len() == values.capacity() initialized elements and attempts to iterate over and drop them. This leads to dereferencing and attempting to free uninitialized memory, resulting in undefined behavior and potential segmentation faults.

The bug was fixed in commit fab6922, and all unsafe code was removed from the crate.

Note that the maintainer recommends using the following alternatives:

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for id-map

Full security history of id-map

Up next

Same crateid-map: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ