From b279ef54825c39c238cf222bf0a619981e26c62b Mon Sep 17 00:00:00 2001 From: programmer12 <964969108@qq.com> Date: Thu, 30 Sep 2021 17:16:03 +0800 Subject: [PATCH] CVE-2019-1010299 --- Fix-unsoundness-in-VecDeque-Debug-impls.patch | 46 +++++++++++++++++++ rust.spec | 5 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 Fix-unsoundness-in-VecDeque-Debug-impls.patch diff --git a/Fix-unsoundness-in-VecDeque-Debug-impls.patch b/Fix-unsoundness-in-VecDeque-Debug-impls.patch new file mode 100644 index 0000000..997f4db --- /dev/null +++ b/Fix-unsoundness-in-VecDeque-Debug-impls.patch @@ -0,0 +1,46 @@ +From b85e4cc8fadaabd41da5b9645c08c68b8f89908d Mon Sep 17 00:00:00 2001 +From: MaloJaffre +Date: Tue, 21 Aug 2018 19:50:05 +0200 +Subject: [PATCH] Fix unsoundness in VecDeque Debug impls + +Fixes #53566. +--- + src/liballoc/collections/vec_deque.rs | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs +index cbc80b70d9775..b16080d246bcb 100644 +--- a/src/liballoc/collections/vec_deque.rs ++++ b/src/liballoc/collections/vec_deque.rs +@@ -1988,11 +1988,11 @@ pub struct Iter<'a, T: 'a> { + #[stable(feature = "collection_debug", since = "1.17.0")] + impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ++ let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail); + f.debug_tuple("Iter") +- .field(&self.ring) +- .field(&self.tail) +- .field(&self.head) +- .finish() ++ .field(&front) ++ .field(&back) ++ .finish() + } + } + +@@ -2085,11 +2085,11 @@ pub struct IterMut<'a, T: 'a> { + #[stable(feature = "collection_debug", since = "1.17.0")] + impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ++ let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail); + f.debug_tuple("IterMut") +- .field(&self.ring) +- .field(&self.tail) +- .field(&self.head) +- .finish() ++ .field(&front) ++ .field(&back) ++ .finish() + } + } + diff --git a/rust.spec b/rust.spec index 67cc7bb..06872a8 100644 --- a/rust.spec +++ b/rust.spec @@ -11,7 +11,7 @@ Name: rust Version: 1.29.1 -Release: 5 +Release: 6 Summary: A systems programming language License: (ASL 2.0 or MIT) and (BSD and MIT) URL: https://www.rust-lang.org @@ -19,6 +19,7 @@ Source0: https://static.rust-lang.org/dist/rustc-1.29.1-src.tar.xz Patch0000: rust-52876-const-endianess.patch Patch0001: 0001-std-stop-backtracing-when-the-frames-are-full.patch Patch0002: 0001-Set-more-llvm-function-attributes-for-__rust_try.patch +Patch0003: Fix-unsoundness-in-VecDeque-Debug-impls.patch BuildRequires: cargo >= 1.28.0 (%{name} >= 1.28.0 with %{name} <= 1.29.1) llvm-devel BuildRequires: make gcc-c++ ncurses-devel curl python3 cmake3 >= 3.4.3 procps-ng BuildRequires: pkgconfig(libcurl) pkgconfig(liblzma) pkgconfig(openssl) pkgconfig(zlib) gdb @@ -286,6 +287,8 @@ python3 ./x.py test --no-fail-fast rustfmt || : %{_mandir}/man1/cargo*.1* %changelog +* Thu Sep 30 2021 liwu - 1.29.1-6 +- Fix CVE-2019-1010299 * Tue Nov 03 2020 Jeffery.Gao - 1.29.1-5 - Reback to 1.29.1 because nodejs upgrade after openEuler-20.03-LTS update -- Gitee