-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
crate:interpreterModifies the interpreterModifies the interpreterfor:maintainabilityImproves maintainers lifeImproves maintainers lifegood first issueGood for newcomersGood for newcomersneeds:implementationNeeds implementation to completeNeeds implementation to complete
Description
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.
Metadata
Metadata
Assignees
Labels
crate:interpreterModifies the interpreterModifies the interpreterfor:maintainabilityImproves maintainers lifeImproves maintainers lifegood first issueGood for newcomersGood for newcomersneeds:implementationNeeds implementation to completeNeeds implementation to complete