Commit c10174c for gzip
commit c10174c45824f7af52ba1c57ccedb4c0dcdaec15
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat Nov 14 16:55:03 2026 -0800
gzip: add static check for slide size
* inflate.c (slide): Check size statically.
diff --git a/inflate.c b/inflate.c
index 0af52b3..12dec09 100644
--- a/inflate.c
+++ b/inflate.c
@@ -148,9 +148,9 @@ static int huft_free (struct huft *);
circular buffer. The index is updated simply by incrementing and then
and'ing with 0x7fff (32K-1). */
/* It is left to other modules to supply the 32K area. It is assumed
- to be usable as if it were declared "uch slide[32768];" or as just
- "uch *slide;" and then malloc'ed in the latter case. The definition
- must be in unzip.h, included above. */
+ to be usable as if it were declared "uch slide[N];" where N is
+ at least 32768. */
+static_assert (sizeof *slide == sizeof (uch) && 32768 <= sizeof slide);
/* unsigned wp; current position in slide */
static bool fresh;
#define wp outcnt