rustsec-2026-0218
Vulnerability from osv_rustsec
Published
2026-07-21 12:00
Modified
2026-07-28 18:34
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.
References
{
"affected": [
{
"database_specific": {
"categories": [
"memory-corruption"
],
"cvss": null,
"informational": "unsound"
},
"ecosystem_specific": {
"affected_functions": null,
"affects": {
"arch": [],
"functions": [],
"os": []
}
},
"package": {
"ecosystem": "crates.io",
"name": "enum-map",
"purl": "pkg:cargo/enum-map"
},
"ranges": [
{
"events": [
{
"introduced": "3.0.0-0.gat.0"
},
{
"fixed": "3.1.0"
}
],
"type": "SEMVER"
}
],
"versions": []
}
],
"aliases": [],
"database_specific": {
"license": "CC0-1.0"
},
"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\u0027s generic parameter `V`.\n\nThis can result in type confusion, and consequently memory corruption, when a manual `Enum` implementation declares an `Array\u003cV\u003e` whose elements are not actually of type `V`:\n\n```rust\nstruct IntentionallyWrong;\n\nimpl Enum for IntentionallyWrong {\n type Array\u003cV\u003e = [String; 4];\n\n fn from_usize(_: usize) -\u003e Self {\n IntentionallyWrong\n }\n\n fn into_usize(self) -\u003e usize {\n 0\n }\n}\n\nenum_map! { IntentionallyWrong =\u003e 42 };\n```\n\nThe flaw was corrected in commit [7a8b815432](https://codeberg.org/sugar700/enum-map/commit/7a8b8154323d426415a10accf104cd05c394cda9) by adding a `Value = V` bound to the `Array` type in the `Enum` trait.",
"id": "RUSTSEC-2026-0218",
"modified": "2026-07-28T18:34:53Z",
"published": "2026-07-21T12:00:00Z",
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/enum-map"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2026-0218.html"
},
{
"type": "WEB",
"url": "https://codeberg.org/sugar700/enum-map/src/branch/master/CHANGELOG.md#version-310"
},
{
"type": "REPORT",
"url": "https://github.com/rustsec/advisory-db/issues/3060"
}
],
"related": [],
"severity": [],
"summary": "`Enum` trait allows type confusion when manually implemented"
}
Loading…
Loading…
Experimental. This forecast is provided for visualization only and may change without notice. Do not use it for operational decisions.
Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Loading…
The MITRE ATT&CK techniques below are AI-generated suggestions, inferred from the description of the
vulnerability by the CIRCL/vulnerability-attack-technique-classification-roberta-base
model, served locally by ML-Gateway.
They have not been verified by an analyst and are provided for guidance only.
Loading…
Loading…