[PATCH 10/21] lib/zlib: update deflate to zlib 1.2.0.7 release

From: Greg Kroah-Hartman

Date: Thu Dec 03 2026 - 02:31:29 EST


Sync the kernel deflate code with the zlib 1.2.0.7 release.

Only one change was "needed", other than the version string update:
- Cast s->pending to uInt in the compress_block() overlay assertion so
the signed/unsigned comparison is well defined when assertions are
compiled in. In reality, this isn't needed for us as we compile all
Assert() calls out in the kernel, so there's no change at all.

There was one 1.2.0.7 change that wasn't relevant to the kernel copy:
- vsnprintf detection.

The kernel is now in sync with zlib commit b97ec631c6f7 ("zlib 1.2.0.7").

Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
include/linux/zlib.h | 2 +-
lib/zlib_deflate/deftree.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 36c4c103e241..fbc88c5e3721 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -32,7 +32,7 @@

#include <linux/zconf.h>

-/* zlib deflate based on ZLIB_VERSION "1.2.0.6" */
+/* zlib deflate based on ZLIB_VERSION "1.2.0.7" */
/* zlib inflate based on ZLIB_VERSION "1.2.3" */

/*
diff --git a/lib/zlib_deflate/deftree.c b/lib/zlib_deflate/deftree.c
index a5bcfbfe9013..2eaf8264cc33 100644
--- a/lib/zlib_deflate/deftree.c
+++ b/lib/zlib_deflate/deftree.c
@@ -1002,7 +1002,8 @@ static void compress_block(
} /* literal or match pair ? */

/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
+ Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
+ "pendingBuf overflow");

} while (lx < s->last_lit);


--
2.56.1