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 zlib-a9e14e85415eb326000f352bce3fcb04a125406d.tar.bz2 zlib-a9e14e85415eb326000f352bce3fcb04a125406d.zip | |
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, | |||
| 279 | 279 | ||
| 280 | if (windowBits < 0) { /* suppress zlib wrapper */ | 280 | if (windowBits < 0) { /* suppress zlib wrapper */ |
| 281 | wrap = 0; | 281 | wrap = 0; |
| 282 | if (windowBits < -15) | ||
| 283 | return Z_STREAM_ERROR; | ||
| 282 | windowBits = -windowBits; | 284 | windowBits = -windowBits; |
| 283 | } | 285 | } |
| 284 | #ifdef GZIP | 286 | #ifdef GZIP |
| @@ -168,6 +168,8 @@ int windowBits; | |||
| 168 | 168 | ||
| 169 | /* extract wrap request from windowBits parameter */ | 169 | /* extract wrap request from windowBits parameter */ |
| 170 | if (windowBits < 0) { | 170 | if (windowBits < 0) { |
| 171 | if (windowBits < -15) | ||
| 172 | return Z_STREAM_ERROR; | ||
| 171 | wrap = 0; | 173 | wrap = 0; |
| 172 | windowBits = -windowBits; | 174 | windowBits = -windowBits; |
| 173 | } | 175 | } |
