Audit suffix_array · Issue #56 · rust-secure-code/safety-dance (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Dependency of qbsdiff by the same author.
Noticed 2 patterns:
std::ptr::copy_nonoverlapping(&src_slice[i] as *const T, &mut dst_slice[j] as *mut T, n)
All non-UB uses can be replaced withdst.slice[j..j+n].copy_from_slice(src_slice[i..i+n])
.std::ptr::copy(&s[i] as *const T, &mut s[j] as *mut T, n)
Same idea, non-UB uses can be replaced withs.copy_within(i..i+n, j)
.
If the ranges are non-overlapping, it might be faster to useslice::split_at_mut
andcopy_from_slice
(resulting in a call tostd::ptr::copy_nonoverlapping
)
Should we request a clippy lint?
Fixes sent upstream: hucsmn/suffix_array#1