Browse Source

Merge branch 'PHP-5.5' into PHP-5.6

* PHP-5.5:
  BFN
  Fixed Bug #67724
pull/761/head
Michael Wallner 12 years ago
parent
commit
b2157ca540
  1. BIN
      ext/zlib/tests/bug67724.gz.gz
  2. 26
      ext/zlib/tests/bug67724.phpt
  3. 3
      ext/zlib/zlib_filter.c

BIN
ext/zlib/tests/bug67724.gz.gz

26
ext/zlib/tests/bug67724.phpt

@ -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

3
ext/zlib/zlib_filter.c

@ -302,7 +302,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…
Cancel
Save