summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/zlibmodule.c8
3 files changed, 11 insertions, 1 deletions
diff --git a/Misc/ACKS b/Misc/ACKS
index 77baff9..dd9e9f6 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -933,6 +933,7 @@ Monty Taylor
Amy Taylor
Anatoly Techtonik
Mikhail Terekhov
+Richard M. Tew
Tobias Thelen
James Thomas
Robin Thomas
diff --git a/Misc/NEWS b/Misc/NEWS
index 85dbe25..b852219 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -268,6 +268,9 @@ Core and Builtins
Library
-------
+- Issue #12839: Fix crash in zlib module due to version mismatch.
+ Fix by Richard M. Tew.
+
- Issue #9923: The mailcap module now correctly uses the platform path
separator for the MAILCAP environment variable on non-POSIX platforms.
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 711004e..f1f84e3 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -53,7 +53,13 @@ typedef struct
static void
zlib_error(z_stream zst, int err, char *msg)
{
- const char *zmsg = zst.msg;
+ const char *zmsg = Z_NULL;
+ /* In case of a version mismatch, zst.msg won't be initialized.
+ Check for this case first, before looking at zst.msg. */
+ if (err == Z_VERSION_ERROR)
+ zmsg = "library version mismatch";
+ if (zmsg == Z_NULL)
+ zmsg = zst.msg;
if (zmsg == Z_NULL) {
switch (err) {
case Z_BUF_ERROR: