summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2005-11-22 22:05:38 +0000
committerSara Golemon <pollita@php.net>2005-11-22 22:05:38 +0000
commit7f367c9d83c3ca7a2e6de0eabab88aed1ce23729 (patch)
treead1a2196cc395ba3522ecda0a5440a729c70dc59 /ext/zlib
parent0d088689c023ab7864374fb44e3912a004b8f17e (diff)
downloadphp-git-7f367c9d83c3ca7a2e6de0eabab88aed1ce23729.tar.gz
Widen allowable range of values for 'window' bits.
Make -MAX_WBITS default (to match gzinflate() and gzdeflate())
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/zlib_filter.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index c14437afb0..d0b3212b93 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -303,7 +303,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
data->strm.data_type = Z_ASCII;
if (strcasecmp(filtername, "zlib.inflate") == 0) {
- int windowBits = MAX_WBITS;
+ int windowBits = -MAX_WBITS;
if (filterparams) {
zval **tmpzval;
@@ -313,7 +313,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
/* log-2 base of history window (9 - 15) */
SEPARATE_ZVAL(tmpzval);
convert_to_long_ex(tmpzval);
- if (Z_LVAL_PP(tmpzval) < 9 || Z_LVAL_PP(tmpzval) > MAX_WBITS) {
+ if (Z_LVAL_PP(tmpzval) < -MAX_WBITS || Z_LVAL_PP(tmpzval) > MAX_WBITS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL_PP(tmpzval));
} else {
windowBits = Z_LVAL_PP(tmpzval);
@@ -328,7 +328,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
} else if (strcasecmp(filtername, "zlib.deflate") == 0) {
/* RFC 1951 Deflate */
int level = Z_DEFAULT_COMPRESSION;
- int windowBits = MAX_WBITS;
+ int windowBits = -MAX_WBITS;
int memLevel = MAX_MEM_LEVEL;
@@ -357,7 +357,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
/* log-2 base of history window (9 - 15) */
SEPARATE_ZVAL(tmpzval);
convert_to_long_ex(tmpzval);
- if (Z_LVAL_PP(tmpzval) < 9 || Z_LVAL_PP(tmpzval) > MAX_WBITS) {
+ if (Z_LVAL_PP(tmpzval) < -MAX_WBITS || Z_LVAL_PP(tmpzval) > MAX_WBITS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL_PP(tmpzval));
} else {
windowBits = Z_LVAL_PP(tmpzval);