Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/php_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ typedef enum _php_output_handler_hook_t {

#define PHP_OUTPUT_HANDLER_INITBUF_SIZE(s) \
( ((s) > 1) ? \
(s) + PHP_OUTPUT_HANDLER_ALIGNTO_SIZE - ((s) % (PHP_OUTPUT_HANDLER_ALIGNTO_SIZE)) : \
((s) + PHP_OUTPUT_HANDLER_ALIGNTO_SIZE - 1) & ~(PHP_OUTPUT_HANDLER_ALIGNTO_SIZE - 1) : \
PHP_OUTPUT_HANDLER_DEFAULT_SIZE \
)
#define PHP_OUTPUT_HANDLER_ALIGNTO_SIZE 0x1000
Expand Down
18 changes: 18 additions & 0 deletions tests/output/gh16135.pht
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
GH-16135: output buffer over-allocated for aligned chunk sizes
--FILE--
<?php
ob_start(null, 8191);
ob_start(null, 8192);
ob_start(null, 8193);
var_dump(array_map(fn ($s) => $s["buffer_size"], ob_get_status(true)));
?>
--EXPECT--
array(3) {
[0]=>
int(8192)
[1]=>
int(8192)
[2]=>
int(12288)
}