Commit ec2603b for zlib
commit ec2603b32d4d3ff9f681d4fb0fb03059ab935dc5
Author: Girma Metaferia <samuelgirmatgt@gmail.com>
Date: Mon Aug 31 05:01:27 2026 -0400
Reject a null dictionary in inflateSetDictionary().
diff --git a/inflate.c b/inflate.c
index d8bcab8..b9c3949 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1191,7 +1191,8 @@ int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary,
int ret;
/* check state */
- if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
+ if (inflateStateCheck(strm) || dictionary == Z_NULL)
+ return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
if (state->wrap != 0 && state->mode != DICT)
return Z_STREAM_ERROR;
diff --git a/test/infcover.c b/test/infcover.c
index f1ad0f9..d21257f 100644
--- a/test/infcover.c
+++ b/test/infcover.c
@@ -361,6 +361,9 @@ local void cover_support(void)
ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK);
ret = inflateSetDictionary(&strm, Z_NULL, 0);
assert(ret == Z_STREAM_ERROR);
+ ret = inflateReset2(&strm, -15); assert(ret == Z_OK);
+ ret = inflateSetDictionary(&strm, Z_NULL, 1);
+ assert(ret == Z_STREAM_ERROR);
ret = inflateEnd(&strm); assert(ret == Z_OK);
mem_done(&strm, "prime");