This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
[spl-token-swap] Unsound implementation in instruction::unpack
#5243
Labels
stale
[bot only] Added to stale content; will be closed soon
The source of unsoundness
solana-program-library/token-swap/program/src/instruction.rs
Lines 605 to 611 in 282c716
Hi, we consider that
instruction::unpack
function unsound because it can castu8
type with any bit patterns to arbitrary types. This could break the validity invariants which should be hold anywhere in rust program. Additionally, it can also break alignment requirements.To reproduce the bug
then run with miri,
To break alignment requirements,
just
cargo run
and get panic,The text was updated successfully, but these errors were encountered: