-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
php-cli core dump calling a badly formed function #8841
Comments
Probably relevant:
|
Indeed! When a global function is compiled, it is entered in the global |
…removing the function from function_table
…removing the function from function_table
…removing the function from function_table
…removing the function from function_table
…removing the function from function_table
…removing the function from function_table
…removing the function from function_table
Glad you guys had fun with this one. I thought of this problem generally as one of not making sure that all allocated objects are in some well defined state even in the smallest unit of allocation. It is especially problematic in real-time
With USE_ZEND_ALLOC=0
|
Another way to create a badly formed function is to use the array append operator in an invalid way:
|
From a quick thinking I'd say it should be up to the SAPI to handle this - not sure if there's much point to handle it for all SAPI's if it's irrelevant for them. So labeling that as cli sapi bug. |
…removing the function from function_table
It's actually not php-cli specific, nor SAPI specific. We should delay the registration of the function into the function table until after the compilation was successful, otherwise the function is mistakingly registered and a NULL dereference will happen when trying to call it. I based my test of Nikita's test, so credits to him for the test: php#8933 (comment)
Description
The following interaction gives a SEGV
Resulted in this output:
But I expected this output instead:
Well anything but a core dump.
This happens in PHP 7.4 too so it is not a PHP 8.1 regression.
PHP Version
PHP 8.1.4
Operating System
CentOS Linux release 7.5.1804 (Core)
The text was updated successfully, but these errors were encountered: