0
0
mirror of https://github.com/madler/zlib.git synced 2026-01-18 17:11:27 +01:00

Zero inflate state on allocation.

To further guard against the propagation of uninitialized memory.
This commit is contained in:
Mark Adler
2026-01-11 09:46:29 -08:00
parent 84045903ee
commit ecbaf031f8

View File

@@ -197,6 +197,7 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
state = (struct inflate_state FAR *)
ZALLOC(strm, 1, sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
zmemzero(state, sizeof(struct inflate_state));
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state;
state->strm = strm;
@@ -1338,6 +1339,7 @@ int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
copy = (struct inflate_state FAR *)
ZALLOC(source, 1, sizeof(struct inflate_state));
if (copy == Z_NULL) return Z_MEM_ERROR;
zmemzero(copy, sizeof(struct inflate_state));
window = Z_NULL;
if (state->window != Z_NULL) {
window = (unsigned char FAR *)