Control: tags 1016710 + patch
Control: tags 1016710 + pending

Dear maintainer,

I've prepared an NMU for zlib (versioned as 1:1.2.11.dfsg-4.1) and
uploaded it to DELAYED/5. Please feel free to tell me if I
should delay it longer.

Regards,
Salvatore
diff -Nru zlib-1.2.11.dfsg/debian/changelog zlib-1.2.11.dfsg/debian/changelog
--- zlib-1.2.11.dfsg/debian/changelog	2022-03-26 00:32:05.000000000 +0100
+++ zlib-1.2.11.dfsg/debian/changelog	2022-08-12 22:15:03.000000000 +0200
@@ -1,3 +1,12 @@
+zlib (1:1.2.11.dfsg-4.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix a bug when getting a gzip header extra field with inflate()
+    (CVE-2022-37434) (Closes: #1016710)
+  * Fix extra field processing bug that dereferences NULL state->head
+
+ -- Salvatore Bonaccorso <[email protected]>  Fri, 12 Aug 2022 22:15:03 +0200
+
 zlib (1:1.2.11.dfsg-4) unstable; urgency=medium
 
   * Pick upstream patch for CVE-2018-25032 (closes: #1008265).
diff -Nru zlib-1.2.11.dfsg/debian/patches/Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch zlib-1.2.11.dfsg/debian/patches/Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
--- zlib-1.2.11.dfsg/debian/patches/Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch	1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.11.dfsg/debian/patches/Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch	2022-08-12 22:15:03.000000000 +0200
@@ -0,0 +1,36 @@
+From: Mark Adler <[email protected]>
+Date: Sat, 30 Jul 2022 15:51:11 -0700
+Subject: Fix a bug when getting a gzip header extra field with inflate().
+Origin: https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1
+Bug-Debian: https://bugs.debian.org/1016710
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2022-37434
+
+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);
+-- 
+2.36.1
+
diff -Nru zlib-1.2.11.dfsg/debian/patches/Fix-extra-field-processing-bug-that-dereferences-NUL.patch zlib-1.2.11.dfsg/debian/patches/Fix-extra-field-processing-bug-that-dereferences-NUL.patch
--- zlib-1.2.11.dfsg/debian/patches/Fix-extra-field-processing-bug-that-dereferences-NUL.patch	1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.11.dfsg/debian/patches/Fix-extra-field-processing-bug-that-dereferences-NUL.patch	2022-08-12 22:15:03.000000000 +0200
@@ -0,0 +1,31 @@
+From: Mark Adler <[email protected]>
+Date: Mon, 8 Aug 2022 10:50:09 -0700
+Subject: Fix extra field processing bug that dereferences NULL state->head.
+Origin: https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d
+
+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);
+-- 
+2.36.1
+
diff -Nru zlib-1.2.11.dfsg/debian/patches/series zlib-1.2.11.dfsg/debian/patches/series
--- zlib-1.2.11.dfsg/debian/patches/series	2022-03-26 00:32:05.000000000 +0100
+++ zlib-1.2.11.dfsg/debian/patches/series	2022-08-12 22:15:03.000000000 +0200
@@ -2,3 +2,5 @@
 use-dso
 use-dso-really
 CVE-2018-25032
+Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
+Fix-extra-field-processing-bug-that-dereferences-NUL.patch

Reply via email to