-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The parameter i lacks of sufficient checks and used directly in get_unchecked under safe public function, which might cause memory risks.
Lines 162 to 166 in 6f78936
| pub fn length_of_array(&self, i: usize) -> usize { | |
| let current = unsafe { *self.offsets.get_unchecked(i) }; | |
| let next = unsafe { *self.offsets.get_unchecked(i + 1) }; | |
| next - current | |
| } |
In Rust, we shoud not face memory issues if merely use safe function API.
Suggestion:
- add sufficient check
- add unsafe to the function declaration to notify the developer
Metadata
Metadata
Assignees
Labels
No labels