Vulnerability DatabaseRUSTSEC-2022-0017

RUSTSEC-2022-0017
Rust vulnerability analysis and mitigation

Overview

A soundness issue was discovered in the array-macro Rust crate (RUSTSEC-2022-0017) where the implementation contains two uses of the $count expression that could evaluate to different values. This vulnerability affects the array-macro crate's implementation of array creation (GitLab Issue).

Technical details

The vulnerability stems from the macro implementation containing $count in two distinct locations: in the array vector initialization let mut vec = $crate::__ArrayVec<_, {$count}>(unsafe { ... }); and in the loop condition while vec.0.len < $count. These expressions could evaluate differently, particularly when involving procedural macros or type-inference information affecting coercions (GitLab Issue).

Impact

When exploited, this vulnerability can lead to memory safety violations and potential segmentation faults in Rust programs using the array-macro crate. A proof-of-concept demonstrates that the issue can be triggered without using procedural macros by leveraging differences in type-inference information (GitLab Issue).

Exploitability

The vulnerability can be exploited through carefully crafted code that takes advantage of type-inference differences or through procedural macros that evaluate to different literals when called twice in expressions like array![0; proc_macro_call()] (GitLab Issue).

Mitigation and workarounds

A proposed fix involves adding a function pub fn __array_vec_capacity(_: &__ArrayVec) -> usize { N } and modifying the loop condition to use while vec.0.len < $crate::__array_vec_capacity(&vec) to ensure consistent evaluation (GitLab Issue).

Additional resources


SourceThis report was generated using AI

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-5x78-73v4-xg6wHIGH8.7
  • Rust logoRust
  • postgres-protocol
NoYesAug 24, 2026
GHSA-fx4f-mhw4-qm7jMEDIUM6.9
  • Rust logoRust
  • vibeio-http
NoYesAug 24, 2026
GHSA-3gjw-f78c-vvpwMEDIUM6.9
  • Rust logoRust
  • tokio-postgres
NoYesAug 24, 2026
GHSA-rgqc-3x5p-6gwgMEDIUM6.9
  • Rust logoRust
  • postgres-protocol
NoYesAug 24, 2026
RUSTSEC-2026-0267NONEN/A
  • Rust logoRust
  • stable-vec
NoYesAug 24, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management