GitHub Advisoryadvisory · crates.io
GHSA-7v4j-8wvr-v55r `array!` macro is unsound when its length is impure constant
MEDIUM
Official page ↗
- Ecosystem
- crates.io
- Packages
- array-macro
- Severity
- Moderate
- Reviewed
- 2022-06-16
Affected packages
• crates.io array-macro: >= 2.1.0, < 2.1.2 → fixed in 2.1.2
Description
Affected versions of this crate did substitute the array length provided by an user at compile-time multiple times.
When an impure constant expression is passed as an array length (such as a result of an impure procedural macro), this can result in the initialization of an array with uninitialized types, which in turn can allow an attacker to execute arbitrary code.
The flaw was corrected in commit d5b63f72 by making sure that array length is substituted just once.
References
- https://github.com/xfix/array-macro/commit/d5b63f72090f3809c21ac28f9cfd84f12559bf7d web
- https://github.com/rustsec/advisory-db/blob/main/crates/array-macro/RUSTSEC-2022-0017.md web
- https://github.com/xfix/array-macro package
- https://gitlab.com/KonradBorowski/array-macro/-/issues/5 web
- https://rustsec.org/advisories/RUSTSEC-2022-0017.html web