Lucene search

K
osvGoogleOSV:RUSTSEC-2023-0075
HistoryDec 20, 2023 - 12:00 p.m.

Unaligned write of u64 on 32-bit and 16-bit platforms

2023-12-2012:00:00
Google
osv.dev
3
u64 write
32-bit platform
16-bit platform
usize alignment
ptr::write_unaligned
wasm32
x86
undefined behavior
standard library
fixed
higher alignment

7.1 High

AI Score

Confidence

Low

Affected versions allocate memory using the alignment of usize and write data
to it of type u64, without using core::ptr::write_unaligned. In platforms
with sub-64bit alignment for usize (including wasm32 and x86) these writes
are insufficiently aligned some of the time.

If using an ordinary optimized standard library, the bug exhibits Undefined
Behavior so may or may not behave in any sensible way, depending on
optimization settings and hardware and other things. If using a Rust standard
library built with debug assertions enabled, the bug manifests deterministically
in a crash (non-unwinding panic) saying “ptr::write requires that the pointer
argument is aligned and non-null”
.

No 64-bit platform is impacted by the bug.

The flaw was corrected by allocating with adequately high alignment on all
platforms.

CPENameOperatorVersion
unsafe-libyamllt0.2.10

7.1 High

AI Score

Confidence

Low