Skip to content

Conversation

@ndossche
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.

@ndossche ndossche 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 ?

@ndossche
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