diff options
author | Mark Adler <fork@madler.net> | 2022-10-06 16:33:42 -0700 |
---|---|---|
committer | Mark Adler <fork@madler.net> | 2022-10-06 20:43:18 -0700 |
commit | a9e14e85415eb326000f352bce3fcb04a125406d (patch) | |
tree | 68f7359d6a55e5a925610d4138dbc24e72a3af64 | |
parent | 138c93cffb76f5c24e4ae6e81e6210428856f825 (diff) | |
download | zlib-a9e14e85415eb326000f352bce3fcb04a125406d.tar.gz |
Avoid undefined negation behavior if windowBits is INT_MIN.
-rw-r--r-- | deflate.c | 2 | ||||
-rw-r--r-- | inflate.c | 2 |
2 files changed, 4 insertions, 0 deletions
@@ -279,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -168,6 +168,8 @@ int windowBits; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { + if (windowBits < -15) + return Z_STREAM_ERROR; wrap = 0; windowBits = -windowBits; } |