diff options
| author | dylni <46035563+dylni@users.noreply.github.com> | 2021-01-18 09:22:17 -0500 |
|---|---|---|
| committer | dylni <46035563+dylni@users.noreply.github.com> | 2021-02-12 22:01:04 -0500 |
| commit | cb647f3e8e32180cde0f0e7a2599a5dc5b35345a (patch) | |
| tree | 8a5eae31d65eb661db31c1e4f6e1c547a30b8af3 /library/alloc/src | |
| parent | 9d29793614cc810fb8febf7f1a2e0202f3919bb6 (diff) | |
| download | rust-cb647f3e8e32180cde0f0e7a2599a5dc5b35345a.tar.gz rust-cb647f3e8e32180cde0f0e7a2599a5dc5b35345a.zip | |
Fix possible soundness issue in `ensure_subset_of`
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/collections/vec_deque/mod.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/lib.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/string.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 0c267cbc106..319ca666fc6 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -1063,7 +1063,7 @@ impl<T> VecDeque<T> { where R: RangeBounds<usize>, { - let Range { start, end } = range.ensure_subset_of(..self.len()); + let Range { start, end } = Range::ensure_subset_of(range, ..self.len()); let tail = self.wrap_add(self.tail, start); let head = self.wrap_add(self.tail, end); (tail, head) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 71b4883aca2..ade2e3fed2c 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -115,7 +115,7 @@ #![feature(or_patterns)] #![feature(pattern)] #![feature(ptr_internals)] -#![feature(range_bounds_ensure_subset_of)] +#![feature(range_ensure_subset_of)] #![feature(rustc_attrs)] #![feature(receiver_trait)] #![cfg_attr(bootstrap, feature(min_const_generics))] diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 3ab5ca4f566..ef2f264ec7e 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1510,7 +1510,7 @@ impl String { // of the vector version. The data is just plain bytes. // Because the range removal happens in Drop, if the Drain iterator is leaked, // the removal will not happen. - let Range { start, end } = range.ensure_subset_of(..self.len()); + let Range { start, end } = Range::ensure_subset_of(range, ..self.len()); assert!(self.is_char_boundary(start)); assert!(self.is_char_boundary(end)); diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 5c20f382224..1a7b846bd85 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1650,7 +1650,7 @@ impl<T, A: Allocator> Vec<T, A> { // the hole, and the vector length is restored to the new length. // let len = self.len(); - let Range { start, end } = range.ensure_subset_of(..len); + let Range { start, end } = Range::ensure_subset_of(range, ..len); unsafe { // set self.vec length's to start, to be safe in case Drain is leaked |
