mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Fixed Bug #67724
(chained zlib filters silently fail with large amounts of data) Use the same buffer size zlib uses internally to avoid Z_DATA_ERROR on massively compressed data
This commit is contained in:
parent
f59506cd27
commit
e4ff7f2ee3
4
NEWS
4
NEWS
@ -40,6 +40,10 @@ PHP NEWS
|
||||
. Fixed bug #60616 (odbc_fetch_into returns junk data at end of multi-byte
|
||||
char fields). (Keyur)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #67724 (chained zlib filters silently fail with large amounts of
|
||||
data). (Mike)
|
||||
|
||||
24 Jul 2014, PHP 5.4.31
|
||||
|
||||
- Core:
|
||||
|
BIN
ext/zlib/tests/bug67724.gz.gz
Normal file
BIN
ext/zlib/tests/bug67724.gz.gz
Normal file
Binary file not shown.
26
ext/zlib/tests/bug67724.phpt
Normal file
26
ext/zlib/tests/bug67724.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #67724 (chained zlib filters silently fail with large amounts of data)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("zlib") or die("skip need ext/zlib");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Test\n";
|
||||
|
||||
$f = fopen(__DIR__."/bug67724.gz.gz", "rb")
|
||||
or die(current(error_get_last()));
|
||||
stream_filter_append($f, "zlib.inflate", STREAM_FILTER_READ, ["window" => 30]);
|
||||
stream_filter_append($f, "zlib.inflate", STREAM_FILTER_READ, ["window" => 30]);
|
||||
for ($i = 0; !feof($f); $i += strlen(fread($f, 0x1000)))
|
||||
;
|
||||
fclose($f);
|
||||
|
||||
var_dump($i);
|
||||
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
Test
|
||||
int(25600000)
|
||||
DONE
|
@ -310,7 +310,8 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
|
||||
|
||||
data->strm.zalloc = (alloc_func) php_zlib_alloc;
|
||||
data->strm.zfree = (free_func) php_zlib_free;
|
||||
data->strm.avail_out = data->outbuf_len = data->inbuf_len = 2048;
|
||||
data->strm.avail_out = data->outbuf_len = 0x8000;
|
||||
data->inbuf_len = 2048;
|
||||
data->strm.next_in = data->inbuf = (Bytef *) pemalloc(data->inbuf_len, persistent);
|
||||
if (!data->inbuf) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed allocating %zd bytes", data->inbuf_len);
|
||||
|
Loading…
Reference in New Issue
Block a user