-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Assertion `size >= page_size + 1 * page_size' failed. #10249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I confirm this happens on 8.1 and higher. The size in EDIT: Given that other stack-related issues in that function throw an exception, I guess this should throw as well? diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c
index 1fec85528f..543da605bd 100644
--- a/Zend/zend_fibers.c
+++ b/Zend/zend_fibers.c
@@ -174,8 +174,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;
- ZEND_ASSERT(size >= page_size + ZEND_FIBER_GUARD_PAGES * page_size);
+ 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);
+ return NULL;
+ }
const size_t stack_size = (size + page_size - 1) / page_size * page_size;
const size_t alloc_size = stack_size + ZEND_FIBER_GUARD_PAGES * page_size; If it look sensible to the maintainers I'll make a PR |
This looks reasonable, please do make a PR. Thank you! |
Co-authored-by: Changochen <[email protected]>
Description
The following code:
Resulted in this output:
git commit: 84af629
Build config:
PHP Version
PHP 8.3.0-dev
Operating System
No response
The text was updated successfully, but these errors were encountered: