cvs: php-src(PHP_5_1) / NEWS /ext/zlib zlib.c /ext/zlib/tests bug_34821.phpt

From: Date: Tue, 25 Oct 2005 15:16:20 +0000
Subject: cvs: php-src(PHP_5_1) / NEWS /ext/zlib zlib.c /ext/zlib/tests bug_34821.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-34776@lists.php.net to get a copy of this message
mike Tue Oct 25 11:16:20 2005 EDT Added files: (Branch: PHP_5_1) /php-src/ext/zlib/tests bug_34821.phpt Modified files: /php-src NEWS /php-src/ext/zlib zlib.c Log: - MFH: fix bug #34821 zlib encoders fail on widely varying binary data on windows http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.159&r2=1.2027.2.160&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.159 php-src/NEWS:1.2027.2.160 --- php-src/NEWS:1.2027.2.159 Tue Oct 25 10:37:28 2005 +++ php-src/NEWS Tue Oct 25 11:16:19 2005 @@ -11,6 +11,8 @@ - Fixed bug #34893 (PHP5.1 overloading, Cannot access private property). (Dmitry) - Fixed bug #34899 (Fixed sqlite extension compile failure). (Ilia) +- Fixed bug #34821 (zlib encoders fail on widely varying binary data on windows) + (Mike, Ilia) - Fixed bug #34782 (token_get_all() gives wrong result). (Dmitry) - Fixed bug #34767 (Zend Engine 1 Compatibility not copying objects correctly). (Dmitry) http://cvs.php.net/diff.php/php-src/ext/zlib/zlib.c?r1=1.183.2.2&r2=1.183.2.3&ty=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.183.2.2 php-src/ext/zlib/zlib.c:1.183.2.3 --- php-src/ext/zlib/zlib.c:1.183.2.2 Fri Sep 2 13:25:16 2005 +++ php-src/ext/zlib/zlib.c Tue Oct 25 11:16:20 2005 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.183.2.2 2005/09/02 17:25:16 iliaa Exp $ */ +/* $Id: zlib.c,v 1.183.2.3 2005/10/25 15:16:20 mike Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -70,6 +70,13 @@ #endif #endif +/* Win32 needs some more memory */ +#ifdef PHP_WIN32 +#define PHP_ZLIB_MODIFIER 100 +#else +#define PHP_ZLIB_MODIFIER 1000 +#endif + #define OS_CODE 0x03 /* FIXME */ #define GZIP_HEADER_LENGTH 10 #define GZIP_FOOTER_LENGTH 8 @@ -386,7 +393,7 @@ RETURN_FALSE; } - l2 = data_len + (data_len / 1000) + 15 + 1; /* room for \0 */ + l2 = data_len + (data_len / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(l2); if (!s2) { RETURN_FALSE; @@ -482,7 +489,7 @@ stream.next_in = (Bytef *) data; stream.avail_in = data_len; - stream.avail_out = stream.avail_in + (stream.avail_in / 1000) + 15 + 1; /* room for \0 */ + stream.avail_out = stream.avail_in + (stream.avail_in / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(stream.avail_out); if (!s2) { @@ -618,7 +625,7 @@ int start_offset = ((do_start && ZLIBG(compression_coding) == CODING_GZIP) ? 10 : 0); int end_offset = (do_end ? 8 : 0); - outlen = (uint) (sizeof(char) * (str_length * 1.001f + 12) + 1); /* leave some room for a trailing \0 */ + outlen = (uint) (sizeof(char) * (str_length / PHP_ZLIB_MODIFIER + 12) + 1); /* leave some room for a trailing \0 */ if ((outlen + start_offset + end_offset) > *p_buffer_len) { buffer = (Bytef *) emalloc(outlen + start_offset + end_offset); } else { @@ -758,7 +765,7 @@ stream.next_in = (Bytef *) data; stream.avail_in = data_len; - stream.avail_out = stream.avail_in + (stream.avail_in / 1000) + 15 + 1; /* room for \0 */ + stream.avail_out = stream.avail_in + (stream.avail_in / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ s2 = (char *) emalloc(stream.avail_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)); /* add gzip file header */ http://cvs.php.net/co.php/php-src/ext/zlib/tests/bug_34821.phpt?r=1.1&p=1 Index: php-src/ext/zlib/tests/bug_34821.phpt +++ php-src/ext/zlib/tests/bug_34821.phpt

« previous php.cvs (#34776) next »