mirror of
https://github.com/openharmony/third_party_rust_tinyvec.git
synced 2026-07-21 01:35:22 -04:00
SliceVec fuzzer + overflow fix on usize::MAX ranges (#99)
* add slicevec fuzzer * prevent overflow on range calculation
This commit is contained in:
@@ -21,11 +21,11 @@ impl<'a, T: 'a + Default> ArrayVecDrain<'a, T> {
|
||||
let start = match range.start_bound() {
|
||||
Bound::Unbounded => 0,
|
||||
Bound::Included(&n) => n,
|
||||
Bound::Excluded(&n) => n + 1,
|
||||
Bound::Excluded(&n) => n.saturating_add(1),
|
||||
};
|
||||
let end = match range.end_bound() {
|
||||
Bound::Unbounded => arr.len(),
|
||||
Bound::Included(&n) => n + 1,
|
||||
Bound::Included(&n) => n.saturating_add(1),
|
||||
Bound::Excluded(&n) => n,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user