Skip to content

Commit a9e14e8

Browse files
author
Mark Adler
committed
Avoid undefined negation behavior if windowBits is INT_MIN.
1 parent 138c93c commit a9e14e8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

deflate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
279279

280280
if (windowBits < 0) { /* suppress zlib wrapper */
281281
wrap = 0;
282+
if (windowBits < -15)
283+
return Z_STREAM_ERROR;
282284
windowBits = -windowBits;
283285
}
284286
#ifdef GZIP

inflate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ int windowBits;
168168

169169
/* extract wrap request from windowBits parameter */
170170
if (windowBits < 0) {
171+
if (windowBits < -15)
172+
return Z_STREAM_ERROR;
171173
wrap = 0;
172174
windowBits = -windowBits;
173175
}

0 commit comments

Comments
 (0)