Skip to content

Commit

Permalink
zlib: patch CVE-2022-37434
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Aug 9, 2022
1 parent 84bacaf commit 55cddd4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ export PEFILE_VER_='2022.5.30'
# NOTE: Set _REV to empty after bumping CURL_VER_, and
# set it to 1 then increment by 1 each time bumping a dependency
# version or pushing a CI rebuild for the main branch.
export _REV='8'
export _REV='9'
34 changes: 34 additions & 0 deletions zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/inflate.c b/inflate.c
index 7be8c6366..7a7289749 100644
--- a/inflate.c
+++ b/inflate.c
@@ -763,9 +763,10 @@ int flush;
copy = state->length;
if (copy > have) copy = have;
if (copy) {
+ len = state->head->extra_len - state->length;
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ len < state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);
diff --git a/inflate.c b/inflate.c
index 7a7289749..2a3c4fe98 100644
--- a/inflate.c
+++ b/inflate.c
@@ -763,10 +763,10 @@ int flush;
copy = state->length;
if (copy > have) copy = have;
if (copy) {
- len = state->head->extra_len - state->length;
if (state->head != Z_NULL &&
state->head->extra != Z_NULL &&
- len < state->head->extra_max) {
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);
1 change: 1 addition & 0 deletions zlib.test.patch

0 comments on commit 55cddd4

Please sign in to comment.