mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-20483: ASAN stack overflow with small fiber.stack_size INI value.
This commit is contained in:
4
NEWS
4
NEWS
@@ -18,6 +18,10 @@ PHP NEWS
|
||||
in $selectors to be lowercase). (ndossche)
|
||||
. Fix missing NUL byte check on C14NFile(). (ndossche)
|
||||
|
||||
- Fibers:
|
||||
. Fixed bug GH-20483 (ASAN stack overflow with fiber.stack_size INI
|
||||
small value). (David Carlier)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug GH-20329 (opcache.file_cache broken with full interned string
|
||||
buffer). (Arnaud)
|
||||
|
||||
16
Zend/tests/fibers/gh20483.phpt
Normal file
16
Zend/tests/fibers/gh20483.phpt
Normal file
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
GH-20483 (ASAN stack overflow with small fiber.stack_size INI value)
|
||||
--INI--
|
||||
fiber.stack_size=1024
|
||||
--FILE--
|
||||
<?php
|
||||
$callback = function () {};
|
||||
$fiber = new Fiber($callback);
|
||||
try {
|
||||
$fiber->start();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fiber stack size is too small, it needs to be at least %d bytes
|
||||
@@ -207,7 +207,12 @@ static zend_fiber_stack *zend_fiber_stack_allocate(size_t size)
|
||||
{
|
||||
void *pointer;
|
||||
const size_t page_size = zend_fiber_get_page_size();
|
||||
const size_t minimum_stack_size = page_size + ZEND_FIBER_GUARD_PAGES * page_size;
|
||||
const size_t minimum_stack_size = page_size + ZEND_FIBER_GUARD_PAGES * page_size
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
// necessary correction due to ASAN redzones
|
||||
* 6
|
||||
#endif
|
||||
;
|
||||
|
||||
if (size < minimum_stack_size) {
|
||||
zend_throw_exception_ex(NULL, 0, "Fiber stack size is too small, it needs to be at least %zu bytes", minimum_stack_size);
|
||||
|
||||
Reference in New Issue
Block a user