Skip to content

`array!` macro is unsound when its length is impure constant

Moderate severity GitHub Reviewed Published Jun 16, 2022 to the GitHub Advisory Database • Updated Jan 12, 2023

Package

cargo array-macro (Rust)

Affected versions

>= 2.1.0, < 2.1.2

Patched versions

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

Published to the GitHub Advisory Database Jun 16, 2022
Reviewed Jun 16, 2022
Last updated Jan 12, 2023

Severity

Moderate

Weaknesses

No CWEs

CVE ID

No known CVE

GHSA ID

GHSA-7v4j-8wvr-v55r

Source code

Credits

Checking history
See something to contribute? Suggest improvements for this vulnerability.