GHSA-7v4j-8wvr-v55r: `array!` macro is unsound when its length is impure constant
N/A
CVSS Score
Basic Information
CVE ID
-
GHSA ID
EPSS Score
-
CWE
-
Published
6/16/2022
Updated
1/12/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
-
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
array-macro | rust | >= 2.1.0, < 2.1.2 | 2.1.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from dual use of $count in:
- __ArrayVec type parameter initialization (<_, {$count}>)
- Loop condition (while vec.0.len < $count)
Before the patch, both positions would re-evaluate the $count expression. The commit fixed this by introducing a __Capacity struct to capture N once via vec.0.capacity.get(), ensuring single evaluation. The vulnerable code path is clearly the macro's loop condition logic prior to this fix, as confirmed by the patch changing 'while vec.0.len < $count' to use the capacity field.