Commit d0fa161 for zlib
commit d0fa1618e473ad74bc6c623869af4fc8a0ca8c9b
Author: Mark Adler <git@madler.net>
Date: Mon Nov 2 09:09:39 2026 -0800
Handle malloc(0) returning NULL in infcover.
The C standards permit malloc(0) to return either a pointer or NULL.
diff --git a/test/infcover.c b/test/infcover.c
index d21257f..6a928a6 100644
--- a/test/infcover.c
+++ b/test/infcover.c
@@ -298,7 +298,7 @@ local void inf(char *hex, char *what, unsigned step, int win, unsigned len,
mem_done(&strm, what);
return;
}
- out = malloc(len); assert(out != NULL);
+ out = malloc(len ? len : 1); assert(out != NULL);
if (win == 47) {
head.extra = out;
head.extra_max = len;