You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Despite the "Notes about safety" section in the readme, this crate is unsound because it allows creating a slice of different allocated objects. See this example of incorrect usage of core::slice::from_raw_parts in it's docs:
use std::slice;fnjoin_slices<'a,T>(fst:&'a[T],snd:&'a[T]) -> &'a[T]{let fst_end = fst.as_ptr().wrapping_add(fst.len());let snd_start = snd.as_ptr();assert_eq!(fst_end, snd_start,"Slices must be contiguous!");unsafe{// The assertion above ensures `fst` and `snd` are contiguous, but they might// still be contained within _different allocated objects_, in which case// creating this slice is undefined behavior.
slice::from_raw_parts(fst.as_ptr(), fst.len() + snd.len())}}fnmain(){// `a` and `b` are different allocated objects...let a = 42;let b = 27;// ... which may nevertheless be laid out contiguously in memory: | a | b |let _ = join_slices(slice::from_ref(&a), slice::from_ref(&b));// UB}
Despite the "Notes about safety" section in the readme, this crate is unsound because it allows creating a slice of different allocated objects. See this example of incorrect usage of
core::slice::from_raw_parts
in it's docs:Consider yanking all crate versions.
The text was updated successfully, but these errors were encountered: