# GHSA-7v4j-8wvr-v55r: `array!` macro is unsound when its length is impure constant

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2022-04-27T12:00:00.000Z
- Modified: 2023-11-08T04:17:00.535Z
- Also known as: RUSTSEC-2022-0017

## 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](https://github.com/xfix/array-macro/commit/d5b63f72090f3809c21ac28f9cfd84f12559bf7d) by making sure that array length is substituted just once.

(As written by GitHub Advisory Database.)

## Affected

- array-macro (crates.io): from 2.1.0 before 2.1.2

## 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> (report, web)
- <https://rustsec.org/advisories/RUSTSEC-2022-0017.html> (advisory, web)
- <https://crates.io/crates/array-macro> (package)

## Sources

- GitHub Advisory Database: [GHSA-7v4j-8wvr-v55r](https://github.com/advisories/GHSA-7v4j-8wvr-v55r), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2022-0017](https://rustsec.org/advisories/RUSTSEC-2022-0017.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-7v4j-8wvr-v55r · Whole record: https://cve.day/GHSA-7v4j-8wvr-v55r.json · Rebuilt by cve.day 2026-11-25T22:56:43.095Z
