From acfeb7df6cb61f24e50e4ecaeba6b79c92cf97ec Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Tue, 4 Nov 2025 00:38:17 -0800 Subject: [PATCH] zlib: pass 15 not 0 to inflateInit2() The convention of passing 0 to inflateInit2() to autodetect the window size is not supported in really old versions of zlib. The only downside with simply passing in the maximum value (15) is potential additional memory buffer allocations, but it is a drop in the bucket for NASM. Fixes: https://github.com/netwide-assembler/nasm/issues/165 Signed-off-by: H. Peter Anvin (Intel) --- asm/uncompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/uncompress.c b/asm/uncompress.c index 646b04d3..7dedd2f1 100644 --- a/asm/uncompress.c +++ b/asm/uncompress.c @@ -40,7 +40,7 @@ char *uncompress_stdmac(macros_t *sm) zs.zalloc = nasm_z_alloc; zs.zfree = nasm_z_free; - if (inflateInit2(&zs, 0) != Z_OK) + if (inflateInit2(&zs, 15) != Z_OK) panic(); if (inflate(&zs, Z_FINISH) != Z_STREAM_END)