-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #908 from microsoft/thcrain/corrosion
Thcrain/corrosion
- Loading branch information
Showing
1 changed file
with
0 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,3 @@ | ||
<<<<<<< HEAD | ||
From 1e43823ef5bc19f8ffa60539f8dc93868d6cc1ef Mon Sep 17 00:00:00 2001 | ||
From: Thomas Crain <[email protected]> | ||
Date: Sun, 25 Apr 2021 13:14:28 -0500 | ||
Subject: [PATCH] Fix CVE-2021-28879 | ||
|
||
Backported from https://github.com/rust-lang/rust/pull/82289/files | ||
|
||
--- | ||
library/core/src/iter/adapters/zip.rs | 3 ++- | ||
library/core/tests/iter.rs | 20 ++++++++++++++++++++ | ||
2 files changed, 22 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs | ||
index 581ac6e0d82..95bb16325ef 100644 | ||
--- a/library/core/src/iter/adapters/zip.rs | ||
+++ b/library/core/src/iter/adapters/zip.rs | ||
@@ -201,6 +201,7 @@ where | ||
Some((self.a.__iterator_get_unchecked(i), self.b.__iterator_get_unchecked(i))) | ||
} | ||
} else if A::may_have_side_effect() && self.index < self.a.size() { | ||
+ self.len += 1; | ||
// match the base implementation's potential side effects | ||
// SAFETY: we just checked that `self.index` < `self.a.len()` | ||
unsafe { | ||
@@ -262,7 +263,7 @@ where | ||
======= | ||
From 173e9c1d6dc4195e9223d6c1f7fe95017c12fd9f Mon Sep 17 00:00:00 2001 | ||
From: Thomas Crain <[email protected]> | ||
Date: Mon, 26 Apr 2021 13:44:39 -0500 | ||
|
@@ -50,7 +23,6 @@ index 8a9f4b8af1e..e480bf2bc28 100644 | |
// SAFETY: we just checked that `i` < `self.a.len()` | ||
unsafe { | ||
@@ -263,7 +264,7 @@ where | ||
>>>>>>> 1.0-dev | ||
if sz_a != sz_b { | ||
let sz_a = self.a.size(); | ||
if a_side_effect && sz_a > self.len { | ||
|
@@ -60,15 +32,6 @@ index 8a9f4b8af1e..e480bf2bc28 100644 | |
} | ||
} | ||
diff --git a/library/core/tests/iter.rs b/library/core/tests/iter.rs | ||
<<<<<<< HEAD | ||
index 00e3972c42f..94787931994 100644 | ||
--- a/library/core/tests/iter.rs | ||
+++ b/library/core/tests/iter.rs | ||
@@ -1882,6 +1882,26 @@ fn test_double_ended_zip() { | ||
assert_eq!(it.next(), None); | ||
} | ||
|
||
======= | ||
index 803dc5d1698..913764894ec 100644 | ||
--- a/library/core/tests/iter.rs | ||
+++ b/library/core/tests/iter.rs | ||
|
@@ -80,7 +43,6 @@ index 803dc5d1698..913764894ec 100644 | |
\ No newline at end of file | ||
+} | ||
+ | ||
>>>>>>> 1.0-dev | ||
+#[test] | ||
+fn test_issue_82282() { | ||
+ fn overflowed_zip(arr: &[i32]) -> impl Iterator<Item = (i32, &())> { | ||
|
@@ -100,15 +62,6 @@ index 803dc5d1698..913764894ec 100644 | |
+ panic!(); | ||
+ } | ||
+} | ||
<<<<<<< HEAD | ||
+ | ||
#[test] | ||
fn test_double_ended_filter() { | ||
let xs = [1, 2, 3, 4, 5, 6]; | ||
-- | ||
2.25.1 | ||
======= | ||
-- | ||
2.25.1 | ||
|
||
>>>>>>> 1.0-dev |