Skip to content

Fix GH-14361: Deep recursion in zend_cfg.c causes segfault instead of error - #14426

Closed
ndossche wants to merge 2 commits into
php:PHP-8.3from
ndossche:fix-14361
Closed

ndossche wants to merge 2 commits into
php:PHP-8.3from
ndossche:fix-14361

Conversation

@ndossche

@ndossche ndossche commented Jun 1, 2024

Copy link
Copy Markdown
Member

Use the same stack limit check already used elsewhere in compilation.

… of error

Use the same stack limit check already used elsewhere in compilation.
@ndossche

ndossche commented Jun 2, 2024 •

Copy link
Copy Markdown
Member Author

I think this needs a different solution, I think we should return a success/failure status from zend_build_cfg depending on the used stack space and then bail out of zend_jit_build_cfg like we already do if there are too many blocks:

/* Don't JIT huge functions. Apart from likely being detrimental due to the amount of
* generated code, some of our analysis is recursive and will stack overflow with many
* blocks. */
if (cfg->blocks_count > 100000) {
return FAILURE;
}

EDIT: I tried that here: #14432

@ndossche ndossche closed this Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deep recursion in zend_cfg.c causes segfault instead of error

1 participant