🛡️ GHSA-83gg-pwxf-jr89 — array-macro
Description
array! macro is unsound in presence of traits that implement methods it calls internally
Affected versions of this crate called some methods using auto-ref. The affected code looked like this.
```rust
let mut arr = $crate::__core::mem::MaybeUninit::uninit();
let mut vec = $crate::__ArrayVec::<T>::new(arr.as_mut_ptr() as *mut T);
```
In this case, the problem is that as_mut_ptr is a method of &mut MaybeUninit, not MaybeUninit. This made it possible for traits to hijack the method calls in order to cause unsoundness.
```rust
trait AsMutPtr<T> {
fn as_mut_ptr(&self) -> *mut T;
}
impl<T> AsMutPtr<T> for std::mem::MaybeUninit<T> {
fn as_mut_ptr(&self) -> *mut T {
std::ptr::null_mut()
}
}
array![0; 1];
```
The flaw was corrected by explicitly referencing variables in macro body in order to avoid auto-ref.
Affected software
GHSA-83gg-pwxf-jr89 is recorded against 1 package.
- array-macro
Timeline and source
Published on 16 June 2022 and last revised on 8 November 2023. No public exploit is currently recorded for this entry. Record sourced from OSV.
References
github.com (Web)
github.com (Web)
github.com (Package)
gitlab.com (Web)
rustsec.org (Web)
Details
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| array-macro | — | — |
References
Similar Threats
- Unknown GHSA-7v4j-8wvr-v55r
- Unknown RUSTSEC-2022-0017
Free Vulnerability Check
Is your site affected by GHSA-83gg-pwxf-jr89?
BotEraser helps you identify potentially vulnerable plugins and themes by checking your installation against GHSA-83gg-pwxf-jr89 and other known CVE records.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.