-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Deep recursion in zend_cfg.c causes segfault instead of error #14361
Comments
It's not an infinite loop, it's just very deep recursion, it does terminate with enough stack space. |
In my opinion it's worth it, especially if the overhead is small, as it improves the user experience by making it easier to track the origin of the issue. NB: under ASAN the default value of |
OK, I'll prepare a patch for 8.3 sometime soon (currently busy with the TSRM ARM stuff) |
Recreating this over and over is pointless, cache this as well. Fixes phpGH-14361.
… of error Use the same stack limit check already used elsewhere in compilation.
… of error Use the same stack limit check already used elsewhere in compilation.
… of error Use the same stack limit check already used elsewhere in compilation.
… of error Building the CFG for JIT or optimizations can run into deep recursion, and depending on the stack limit cause a segfault. This patch uses the stack limit check to fail out of those cases. This prevents a segfault. We use this check elsewhere in the compiler as well. However, in this case we just make optimizations or JIT fail without aborting the application such that code can still execute. The attached test case will succeed both without and with this patch, it is mainly intended to test if propagating failure doesn't cause crashes. To reproduce the issue, set a low stack limit using `ulimit -s` and run the original test case from php#14361
… of error Building the CFG for JIT or optimizations can run into deep recursion, and depending on the stack limit cause a segfault. This patch uses the stack limit check to fail out of those cases. This prevents a segfault. We use this check elsewhere in the compiler as well. However, in this case we just make optimizations or JIT fail without aborting the application such that code can still execute. The attached test case will succeed both without and with this patch, it is mainly intended to test if propagating failure doesn't cause crashes. To reproduce the issue, set a low stack limit using `ulimit -s` and run the original test case from php#14361
Description
The following code:
This is the php code from Zend/tests/runtime_compile_time_binary_operands.phpt
Resulted in this output:
or
But I expected this output instead:
To reproduce:
I did not meet such infinite loop before. I am not sure if it is expected. Please kindly close it if everything works well.
PHP Version
nightly
Operating System
ubuntu 22.04
The text was updated successfully, but these errors were encountered: