Skip to content

Fix GH-8841: php-cli core dump calling a badly formed function #10989

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

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Apr 1, 2023

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: #8933 (comment)

EDIT: I thought I was making a PR against my own fork, to already let it go through CI on my fork. But apparantly the "create PR" shortcut button creates the PR against upstream, hence the change in title 😅

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)
@nielsdos nielsdos changed the title [ci test run] Fix GH-8841: php-cli core dump calling a badly formed function Fix GH-8841: php-cli core dump calling a badly formed function Apr 1, 2023
@nielsdos nielsdos linked an issue Apr 1, 2023 that may be closed by this pull request
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix makes sense to me!

@nielsdos nielsdos closed this in cf9b030 Apr 1, 2023
@gjcarrette
Copy link

Yes, makes sense in my issue too. This would happen in any file loaded by php in any environment.
And if somebody used the eval function it would even be more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

php-cli core dump calling a badly formed function
3 participants