mirror of
https://github.com/php/php-src.git
synced 2026-03-28 02:02:32 +01:00
Fix infinite recursion bug when using zlib output compression.
Cause: the chunk size is taken from the zlib.output_compression setting, which is 0 or 1. This causes the block_size for output buffer to be set to 0 (1 / 2) and thus causes infinite recursion in php_ob_allocate(). Solution: use a value of 0 for the chunk size which will use the default sizes. Also add a sanity check which will default the block_size to 1 if it ends up as 0.
This commit is contained in:
@@ -230,6 +230,8 @@ PHP_RINIT_FUNCTION(zlib)
|
||||
ZLIBG(ob_gzhandler_status) = 0;
|
||||
ZLIBG(ob_gzip_coding) = 0;
|
||||
if (chunk_size) {
|
||||
if (chunk_size == 1)
|
||||
chunk_size = 0; /* use the default size */
|
||||
php_enable_output_compression(chunk_size TSRMLS_CC);
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
@@ -132,6 +132,8 @@ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool
|
||||
if (chunk_size) {
|
||||
initial_size = (chunk_size*3/2);
|
||||
block_size = chunk_size/2;
|
||||
if (block_size == 0)
|
||||
block_size = 1;
|
||||
} else {
|
||||
initial_size = 40*1024;
|
||||
block_size = 10*1024;
|
||||
|
||||
Reference in New Issue
Block a user