Email me

Rust advisories / enum-map

UnsoundRUSTSEC-2026-0218 · enum-map

RUSTSEC-2026-0218: `Enum` trait allows type confusion when manually implemented

Short answerenum-map has an API that can cause undefined behaviour from safe code: `Enum` trait allows type confusion when manually implemented. Fixed in 3.1.0.

Crateenum-map
TypeUnsound (memory-corruption)
Affected versionsFrom 3.0.0-0.gat.0 before 3.1.0.
Fixed in3.1.0
Severitynot scored
Published2026-07-21
Last changed2026-07-28
Also known asnone

What to do

  1. See which version you have: cargo tree -i enum-map (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p enum-map. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example enum-map = "3.1.0") 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

Affected versions of this crate did not require the element type of the Array associated type in the Enum trait to match the array's generic parameter V.

This can result in type confusion, and consequently memory corruption, when a manual Enum implementation declares an Array<V> whose elements are not actually of type V:

struct IntentionallyWrong;

impl Enum for IntentionallyWrong {
    type Array<V> = [String; 4];

    fn from_usize(_: usize) -> Self {
        IntentionallyWrong
    }

    fn into_usize(self) -> usize {
        0
    }
}

enum_map! { IntentionallyWrong => 42 };

The flaw was corrected in commit 7a8b815432 by adding a Value = V bound to the Array type in the Enum trait.

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 enum-map

Full security history of enum-map

Up next

Same crateenum-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