RUSTSEC-2026-0218

Source
https://rustsec.org/advisories/RUSTSEC-2026-0218
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0218.json
JSON Data
https://api.osv.dev/v1/vulns/RUSTSEC-2026-0218
Published
2026-07-21T12:00:00Z
Modified
2026-07-28T18:45:04.794215742Z
Summary
`Enum` trait allows type confusion when manually implemented
Details

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.

Database specific
{
    "license": "CC0-1.0"
}
References

Affected packages

crates.io / enum-map

Package

Affected ranges

Type
SEMVER
Events
Introduced
3.0.0-0.gat.0
Fixed
3.1.0

Ecosystem specific

{
    "affects": {
        "os": [],
        "functions": [],
        "arch": []
    },
    "affected_functions": null
}

Database specific

source
"https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0218.json"
informational
"unsound"
categories
[
    "memory-corruption"
]
cvss
null