GHSA-83gg-pwxf-jr89
`array!` macro is unsound in presence of traits that implement methods it calls internally
GHSA-83gg-pwxf-jr89 is a vulnerability with no CVSS score yet in array-macro, published May 7, 2020. No source lists public exploit code. Fixed in array-macro 1.0.5.
- Severity
- UnratedNo CVSS score yet
- Exploit chance
- UnscoredNo EPSS score yet
- Exploitation
- None knownNot on CISA’s or ENISA’s lists
- Fixed in
1.0.5array-macro
Description
Affected versions of this crate called some methods using auto-ref. The affected code looked like this.
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.
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 packages
| Package | Affected | Fixed |
|---|---|---|
array-macrocrates.io | 0.1.2 up to 1.0.5 | 1.0.5 |
What each source reports
GitHub AdvisoriesNo score
`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.
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.
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.
- Record
GHSA-83gg-pwxf-jr89- Updated
- 2026-11-02
OSVNo score
`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.
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.
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.
- Record
GHSA-83gg-pwxf-jr89- Updated
- 2026-11-02
OSVRUSTSEC-2020-0161No score
`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.
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.
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.
- Record
RUSTSEC-2020-0161- Updated
- 2026-11-02
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | GitHub Advisories, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
References
github.com/rustsec/advisory-db/blob/main/crates/array-macro/RUSTSEC-2020-0161.md
rustsec.org/advisories/RUSTSEC-2020-0161.html
github.com/xfix/array-macro/commit/01940637dd8f3bfeeee3faf9639fa9ae52f19f4d
gitlab.com/KonradBorowski/array-macro/-/commit/01940637dd8f3bfeeee3faf9639fa9ae52f19f4d
github.com/advisories/GHSA-83gg-pwxf-jr89
github.com/xfix/array-macro
crates.io/crates/array-macro