`simd-json-derive` vulnerable to `MaybeUninit` misuse
Moderate severity
GitHub Reviewed
Published
Nov 12, 2024
to the GitHub Advisory Database
•
Updated Nov 12, 2024
Description
Published to the GitHub Advisory Database
Nov 12, 2024
Reviewed
Nov 12, 2024
Last updated
Nov 12, 2024
An invalid use of
MaybeUninit::uninit().assume_init()
insimd-json-derive
's derive macro can cause undefined behavior. The original code usedMaybeUninit
to avoid initialisation of the struct and then set the fields usingptr::write
. The undefined behavior triggered by this misuse ofMaybeUninit
can lead to invlaid memory access and panics in binaries compiled in release mode (aka simd-json-derive prior to version 0.12 has UB and optimizes into some nonsense)The version
0.12.0
removes this section of code, avoiding the use of MaybeUninit alltogether.References