rust/0001-bootstrap-config-fix-version-comparison-bug.patch
Josh Stone cd2d5f3610 Update to 1.71.1.
Security fix for CVE-2023-38497
2023-08-07 14:57:21 -07:00

37 lines
1.6 KiB
Diff

From a627c8f54cab6880dc7d36c55092a94c6f750a6e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 3 Aug 2023 15:05:40 -0700
Subject: [PATCH] bootstrap: config: fix version comparison bug
Rust requires a previous version of Rust to build, such as the current version, or the
previous version. However, the version comparison logic did not take patch releases
into consideration when doing the version comparison for the current branch, e.g.
Rust 1.71.1 could not be built by Rust 1.71.0 because it is neither an exact version
match, or the previous version.
Adjust the version comparison logic to tolerate mismatches in the patch version.
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
(cherry picked from commit 31a81a08786826cc6e832bd0b49fb8b934e29648)
---
src/bootstrap/config.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index e192cda9a9a7..2b5d0b94e968 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -1805,7 +1805,8 @@ pub fn check_build_rustc_version(&self) {
.unwrap();
if !(source_version == rustc_version
|| (source_version.major == rustc_version.major
- && source_version.minor == rustc_version.minor + 1))
+ && (source_version.minor == rustc_version.minor
+ || source_version.minor == rustc_version.minor + 1)))
{
let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1);
eprintln!(
--
2.41.0