`array!` macro is unsound in presence of traits that implement methods it calls internally
Moderate severity
GitHub Reviewed
Published
Jun 16, 2022
to the GitHub Advisory Database
•
Updated Jun 13, 2023
Description
Published to the GitHub Advisory Database
Jun 16, 2022
Reviewed
Jun 16, 2022
Last updated
Jun 13, 2023
Affected versions of this crate called some methods using auto-ref. The affected code looked like this.
In this case, the problem is that
as_mut_ptr
is a method of&mut MaybeUninit
, notMaybeUninit
. This made it possible for traits to hijack the method calls in order to cause unsoundness.The flaw was corrected by explicitly referencing variables in macro body in order to avoid auto-ref.
References