crates/interpreter/src/toctou.rs:111
pub fn get(xs: &[u8], i: usize) -> u8 {
#[cfg(not(feature = "toctou"))]
return unsafe { *xs.get_unchecked(i) };
#[cfg(feature = "toctou")]
xs[i]
}
pub fn split_at(xs: &[u8], mid: usize) -> (&[u8], &[u8]) {
#[cfg(not(feature = "toctou"))]
return unsafe { xs.split_at_unchecked(mid) };
#[cfg(feature = "toctou")]
xs.split_at(mid)
}
Functions get and split_atare public and safe, they accept parameters and used in unsafe functions without sufficient checks (when certain feature flag is set up), which might cause memory risks. In Rust, we should not face any security risks when merely using safe function.
crates/interpreter/src/toctou.rs:111
Functions
getandsplit_atare public and safe, they accept parameters and used in unsafe functions without sufficient checks (when certain feature flag is set up), which might cause memory risks. In Rust, we should not face any security risks when merely using safe function.