Skip to content

Fix GH-11347: Memory leak when calling a static method inside an xpath query #11350

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

It's a type confusion bug. zend_make_callable may change the function name of the fci to become an array, causing a crash in debug mode on zval_ptr_dtor_str(&fci.function_name); in dom_xpath_ext_function_php. On a production build it doesn't crash but only causes a leak, because the array elements are not destroyed, only the array container itself is.

@nielsdos nielsdos linked an issue May 30, 2023 that may be closed by this pull request
…path query

It's a type confusion bug. `zend_make_callable` may change the function name
of the fci to become an array, causing a crash in debug mode on
`zval_ptr_dtor_str(&fci.function_name);` in `dom_xpath_ext_function_php`.
On a production build it doesn't crash but only causes a leak, because
the array elements are not destroyed, only the array container itself
is. We can use the nogc variant because it cannot contain cycles, the
potential array can only contain 2 strings.
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Makes sense to me

@flmommens
Copy link

Thanks for fixing the issue. Will this patch be in the next release 8.1.19 ?

@nielsdos
Copy link
Member Author

Thanks for fixing the issue. Will this patch be in the next release 8.1.19 ?

8.1.19 is already released. The next release is 8.1.20, but that one's already tagged.
This fix can make it in the release after that: 8.1.21.

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.

Memory leak when calling a static method inside an xpath query
3 participants