Skip to content

Commit 143bc76

Browse files
FaauxChris BrammerFrankXie05
authored
[zlib] Fix CVE-2022-37434 (#26792)
* [zlib] Fix CVE-2022-37434 * [zlib] Merge actual patch * Update ports/zlib/CVE-2022-37434.patch Co-authored-by: Frank <65999885+FrankXie05@users.noreply.github.com> * [zlib] Update version SHA Co-authored-by: Chris Brammer <brammer@extend3d.de> Co-authored-by: Frank <65999885+FrankXie05@users.noreply.github.com>
1 parent 86cab74 commit 143bc76

5 files changed

Lines changed: 25 additions & 2 deletions

File tree

ports/zlib/CVE-2022-37434.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/inflate.c b/inflate.c
2+
index 7be8c6366..7a7289749 100644
3+
--- a/inflate.c
4+
+++ b/inflate.c
5+
@@ -763,9 +763,10 @@ int flush;
6+
copy = state->length;
7+
if (copy > have) copy = have;
8+
if (copy) {
9+
if (state->head != Z_NULL &&
10+
- state->head->extra != Z_NULL) {
11+
- len = state->head->extra_len - state->length;
12+
+ state->head->extra != Z_NULL &&
13+
+ (len = state->head->extra_len - state->length) <
14+
+ state->head->extra_max) {
15+
zmemcpy(state->head->extra + len, next,
16+
len + copy > state->head->extra_max ?
17+
state->head->extra_max - len : copy);

ports/zlib/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ vcpkg_from_github(
99
0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
1010
debug-postfix-mingw.patch
1111
0002-android-build-mingw.patch
12+
CVE-2022-37434.patch
1213
)
1314

1415
# This is generated during the cmake build

ports/zlib/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zlib",
33
"version": "1.2.12",
4-
"port-version": 1,
4+
"port-version": 2,
55
"description": "A compression library",
66
"homepage": "https://www.zlib.net/",
77
"license": "Zlib",

versions/baseline.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8054,7 +8054,7 @@
80548054
},
80558055
"zlib": {
80568056
"baseline": "1.2.12",
8057-
"port-version": 1
8057+
"port-version": 2
80588058
},
80598059
"zlib-ng": {
80608060
"baseline": "2.0.6",

versions/z-/zlib.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "d40d86865ecbcc5b54d21f840dd2212556aeadd5",
5+
"version": "1.2.12",
6+
"port-version": 2
7+
},
38
{
49
"git-tree": "ecc4c064d4911faf12d8bf5fd6bcd5c556d89774",
510
"version": "1.2.12",

0 commit comments

Comments
 (0)