RUSTSEC-2026-0582: On maps of `u16::MAX` elements, `IndexMap::insert` could lead to a broken invariant
Published 2026-11-18 · Updated 2026-11-19
Summary
A flaw in heapless can cause IndexMap::insert to break a map invariant when a map is filled to u16::MAX elements and the final inserted item hashes to u16::MAX. Developers using affected versions of heapless should upgrade to the patched release.
Who is affected
The affected deployment scope is crates.io heapless from version 0.0.0-0 through versions preceding 0.9.4. Exploitation requires the map to contain u16::MAX elements and the last inserted item to hash to u16::MAX. The report notes this is very unlikely to be reachable in a real-world scenario.
Exploitability
The CVSS vector and base score are not documented. EPSS is not yet available. CISA KEV is not YES, so active exploitation should not be claimed.
Remediation
- Upgrade the heapless crate to version 0.9.4, the fixed version listed in the record.
- Review Cargo.toml and Cargo.lock to ensure no direct or transitive dependency resolves to a heapless version below 0.9.4.
How to check your project
- Inspect Cargo.lock for the heapless crate and identify any resolved version earlier than 0.9.4.
Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| crates.io | heapless |
>= 0.0.0-0, < 0.9.4 | 0.9.4 | cargo update -p heapless --precise 0.9.4 |
FAQ
What is the flaw?
IndexMap::insert in heapless may break a map invariant when the map holds u16::MAX elements and the last inserted element hashes to u16::MAX.
Which versions are affected?
heapless versions introduced at 0.0.0-0 are affected; version 0.9.4 is the fixed release.
Is this vulnerability known to be actively exploited?
No. CISA KEV is not YES, and the record does not document active exploitation.
Original advisory description
References
- PACKAGE https://crates.io/crates/heapless
- ADVISORY https://rustsec.org/advisories/RUSTSEC-2026-0582.html
- REPORT https://github.com/rust-embedded/heapless/issues/672
Source records: RUSTSEC-2026-0582 (OSV.dev).