diff options
author | Christian Melki <christian.melki@t2data.com> | 2022-09-07 12:28:11 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2022-09-09 11:47:19 +0200 |
commit | 90f7f51f26313d27d1e0021f623c8746c12d109b (patch) | |
tree | 69b5eb8d1aaf558895cefdf3f4b27863c7d448f1 | |
parent | a7ca3e29e2f94926687cb5719bf8287c41fabb0a (diff) | |
download | ptxdist-90f7f51f26313d27d1e0021f623c8746c12d109b.tar.gz ptxdist-90f7f51f26313d27d1e0021f623c8746c12d109b.tar.xz |
zlib: Fix CVE-2022-37434.
Severity score of 9.8.
https://nvd.nist.gov/vuln/detail/CVE-2022-37434
Patches taken from zlib develop branch.
https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d
https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1
Signed-off-by: Christian Melki <christian.melki@t2data.com>
Message-Id: <20220907102811.628405-1-christian.melki@t2data.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
3 files changed, 62 insertions, 1 deletions
diff --git a/patches/zlib-1.2.12/0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch b/patches/zlib-1.2.12/0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch new file mode 100644 index 000000000..e8b36be46 --- /dev/null +++ b/patches/zlib-1.2.12/0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch @@ -0,0 +1,31 @@ +From: Mark Adler <fork@madler.net> +Date: Sat, 30 Jul 2022 15:51:11 -0700 +Subject: [PATCH] Fix a bug when getting a gzip header extra field with + inflate(). + +If the extra field was larger than the space the user provided with +inflateGetHeader(), and if multiple calls of inflate() delivered +the extra header data, then there could be a buffer overflow of the +provided space. This commit assures that provided space is not +exceeded. +--- + inflate.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/inflate.c b/inflate.c +index 7be8c63662a7..7a728974923a 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/patches/zlib-1.2.12/0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch b/patches/zlib-1.2.12/0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch new file mode 100644 index 000000000..381c52128 --- /dev/null +++ b/patches/zlib-1.2.12/0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch @@ -0,0 +1,28 @@ +From: Mark Adler <fork@madler.net> +Date: Mon, 8 Aug 2022 10:50:09 -0700 +Subject: [PATCH] Fix extra field processing bug that dereferences NULL + state->head. + +The recent commit to fix a gzip header extra field processing bug +introduced the new bug fixed here. +--- + inflate.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/inflate.c b/inflate.c +index 7a728974923a..2a3c4fe98464 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); diff --git a/patches/zlib-1.2.12/series b/patches/zlib-1.2.12/series index ac92b3ba7..5287c5835 100644 --- a/patches/zlib-1.2.12/series +++ b/patches/zlib-1.2.12/series @@ -1,4 +1,6 @@ # generated by git-ptx-patches #tag:base --start-number 1 0001-Fix-configure-issue-that-discarded-provided-CC-defin.patch -# 5dfc5088b94416c3eb59b1a207bdec70 - git-ptx-patches magic +0002-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch +0003-Fix-extra-field-processing-bug-that-dereferences-NUL.patch +# cd27facc69e3374f1354a2aca57309ec - git-ptx-patches magic |