stackvector: apply changes from manually prepared upload
( see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=986891 for why upload was manually prepared )
Peter Michael Green
3 years ago
|
0 |
rust-stackvector (1.0.6-3) unstable; urgency=medium
|
|
1 |
|
|
2 |
* Team upload.
|
|
3 |
* Apply upstream patch for RUSTSEC-2021-0048/CVE-2021-29939 (Closes: 986808)
|
|
4 |
|
|
5 |
-- Peter Michael Green <plugwash@debian.org> Tue, 13 Apr 2021 13:50:50 +0000
|
|
6 |
|
0 | 7 |
rust-stackvector (1.0.6-2) unstable; urgency=medium
|
1 | 8 |
|
2 | 9 |
* Team upload.
|
|
0 |
commit f45657d5a823a67bb3f5cffee65efbb401a44192
|
|
1 |
Author: Alex Huszagh <ahuszagh@gmail.com>
|
|
2 |
Date: Mon Apr 12 18:30:54 2021 -0500
|
|
3 |
|
|
4 |
Proposed fix for https://github.com/RustSec/advisory-db/pull/847
|
|
5 |
|
|
6 |
diff --git a/src/lib.rs b/src/lib.rs
|
|
7 |
index 21de1d9..0386413 100644
|
|
8 |
--- a/src/lib.rs
|
|
9 |
+++ b/src/lib.rs
|
|
10 |
@@ -894,27 +894,10 @@ impl<A: Array> iter::FromIterator<A::Item> for StackVec<A> {
|
|
11 |
|
|
12 |
impl<A: Array> Extend<A::Item> for StackVec<A> {
|
|
13 |
fn extend<I: iter::IntoIterator<Item=A::Item>>(&mut self, iterable: I) {
|
|
14 |
- let mut iter = iterable.into_iter();
|
|
15 |
- let (lower_bound, upper_bound) = iter.size_hint();
|
|
16 |
- let upper_bound = upper_bound.expect("iterable must provide upper bound.");
|
|
17 |
- assert!(self.len() + upper_bound <= self.capacity());
|
|
18 |
-
|
|
19 |
- unsafe {
|
|
20 |
- let len = self.len();
|
|
21 |
- let ptr = self.as_mut_ptr().padd(len);
|
|
22 |
- let mut count = 0;
|
|
23 |
- while count < lower_bound {
|
|
24 |
- if let Some(out) = iter.next() {
|
|
25 |
- ptr::write(ptr.padd(count), out);
|
|
26 |
- count += 1;
|
|
27 |
- } else {
|
|
28 |
- break;
|
|
29 |
- }
|
|
30 |
- }
|
|
31 |
- self.set_len(len + count);
|
|
32 |
- }
|
|
33 |
-
|
|
34 |
- for elem in iter {
|
|
35 |
+ // size_hint() has no safety guarantees, and TrustedLen
|
|
36 |
+ // is nightly only, so we can't do any optimizations with
|
|
37 |
+ // size_hint.
|
|
38 |
+ for elem in iterable.into_iter() {
|
|
39 |
self.push(elem);
|
|
40 |
}
|
|
41 |
}
|
|
0 |
rustsec-2021-0048.patch
|