GitHub Advisoryadvisory · crates.io

GHSA-f7qj-v3vp-4856 libafl has unsound usages of `core::slice::from_raw_parts_mut`

MEDIUM Published 2024-12-23 Modified 2024-12-23 Official page ↗
Ecosystem
crates.io
Packages
libafl
Severity
Moderate
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
Reviewed
2024-12-23

Affected packages

• crates.io libafl: < 0.11.2 → fixed in 0.11.2

Description

The library breaks the safety assumptions when using unsafe API `slice::from_raw_parts_mut`. The pointer passed to `from_raw_parts_mut` is misaligned by casting `u8` to `u16` raw pointer directly, which is unsound. The bug is patched by using `align_offset`, which could make sure the memory address is aligned to 2 bytes for `u16`. This was patched in 0.11.2 in the commit.

References