Skip to content

Commit b775a40

Browse files
[AUTO-CHERRYPICK] Recreated cloud-hypervisor patch for CVE-2025-1744 [Critical] - branch main (#12916)
Co-authored-by: Kanishk Bansal <103916909+Kanishk-Bansal@users.noreply.github.com>
1 parent ff90004 commit b775a40

2 files changed

Lines changed: 50 additions & 12 deletions

File tree

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
From b49d2f0b84d424ec7fbf47138bf6acc6b18e1b0d Mon Sep 17 00:00:00 2001
2-
From: tabudz <tanb74653@gmail.com>
3-
Date: Tue, 18 Feb 2025 11:28:15 +0800
1+
From eff308af425b67093bab25f80f1ae950166bece1 Mon Sep 17 00:00:00 2001
2+
From: Mark Adler <fork@madler.net>
3+
Date: Sat, 30 Jul 2022 15:51:11 -0700
44
Subject: [PATCH] Fix a bug when getting a gzip header extra field with
5-
inflate(). If the extra field was larger than the space the user provided
6-
with inflateGetHeader(), and if multiple calls of inflate() delivered the
7-
extra header data, then there could be a buffer overflow of the provided
8-
space. This commit assures that provided space is not exceeded.
5+
inflate().
96

10-
Upstream Reference: https://github.com/radareorg/radare2/pull/23969/commits/b49d2f0b84d424ec7fbf47138bf6acc6b18e1b0d
7+
If the extra field was larger than the space the user provided with
8+
inflateGetHeader(), and if multiple calls of inflate() delivered
9+
the extra header data, then there could be a buffer overflow of the
10+
provided space. This commit assures that provided space is not
11+
exceeded.
12+
13+
Upstream Reference : https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1
1114
---
1215
inflate.c | 5 +++--
1316
1 file changed, 3 insertions(+), 2 deletions(-)
1417

1518
diff --git a/inflate.c b/inflate.c
16-
index e9ed74cff3279..2ecfb4876d155 100644
19+
index 7be8c6366..7a7289749 100644
1720
--- a/inflate.c
1821
+++ b/inflate.c
19-
@@ -755,9 +755,10 @@ int ZEXPORT inflate(z_streamp strm, int flush)
22+
@@ -763,9 +763,10 @@ int flush;
2023
copy = state->length;
2124
if (copy > have) copy = have;
2225
if (copy) {
@@ -29,3 +32,35 @@ index e9ed74cff3279..2ecfb4876d155 100644
2932
zmemcpy(state->head->extra + len, next,
3033
len + copy > state->head->extra_max ?
3134
state->head->extra_max - len : copy);
35+
36+
From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001
37+
From: Mark Adler <fork@madler.net>
38+
Date: Mon, 8 Aug 2022 10:50:09 -0700
39+
Subject: [PATCH] Fix extra field processing bug that dereferences NULL
40+
state->head.
41+
42+
The recent commit to fix a gzip header extra field processing bug
43+
introduced the new bug fixed here.
44+
Upstream Reference : https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d
45+
46+
---
47+
inflate.c | 4 ++--
48+
1 file changed, 2 insertions(+), 2 deletions(-)
49+
50+
diff --git a/inflate.c b/inflate.c
51+
index 7a7289749..2a3c4fe98 100644
52+
--- a/inflate.c
53+
+++ b/inflate.c
54+
@@ -763,10 +763,10 @@ int flush;
55+
copy = state->length;
56+
if (copy > have) copy = have;
57+
if (copy) {
58+
- len = state->head->extra_len - state->length;
59+
if (state->head != Z_NULL &&
60+
state->head->extra != Z_NULL &&
61+
- len < state->head->extra_max) {
62+
+ (len = state->head->extra_len - state->length) <
63+
+ state->head->extra_max) {
64+
zmemcpy(state->head->extra + len, next,
65+
len + copy > state->head->extra_max ?
66+
state->head->extra_max - len : copy);

SPECS/cloud-hypervisor/cloud-hypervisor.spec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Summary: Cloud Hypervisor is an open source Virtual Machine Monitor (VMM) that runs on top of KVM.
66
Name: cloud-hypervisor
77
Version: 32.0
8-
Release: 5%{?dist}
8+
Release: 6%{?dist}
99
License: ASL 2.0 OR BSD-3-clause
1010
Vendor: Microsoft Corporation
1111
Distribution: Mariner
@@ -166,7 +166,10 @@ cargo build --release --target=%{rust_musl_target} --package vhost_user_block %{
166166
%license LICENSE-BSD-3-Clause
167167

168168
%changelog
169-
* Tue Mar 04 2024 Kanishk Bansal <kanbansal@microsoft.com> - 32.0-4
169+
* Tue Mar 04 2024 Kanishk Bansal <kanbansal@microsoft.com> - 32.0-6
170+
- Recreated patch for CVE-2025-1744 to address a bug introduced by the previous patch. This update includes both the CVE fix and the bug fix.
171+
172+
* Tue Mar 04 2024 Kanishk Bansal <kanbansal@microsoft.com> - 32.0-5
170173
- Patch CVE-2025-1744
171174

172175
* Mon May 20 2024 Saul Paredes <saulparedes@microsoft.com> - 32.0-4

0 commit comments

Comments
 (0)