Skip to content

Fix segfault in mb_strrpos/mb_strripos with ASCII encoding and negative offset #11220

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 2 commits into from

Conversation

iluuu1994
Copy link
Member

We're setting the encoding from PHP_FUNCTION(mb_strpos), but mbfl_strpos would discard it, setting it to mbfl_encoding_pass, making zend_memnrstr fail due to a null-pointer exception.

Fixes GH-11217

iluuu1994 and others added 2 commits May 10, 2023 14:30
…ve offset

We're setting the encoding from PHP_FUNCTION(mb_strpos), but mbfl_strpos would
discard it, setting it to mbfl_encoding_pass, making zend_memnrstr fail due to a
null-pointer exception.

Fixes phpGH-11217
@alexdowad
Copy link
Contributor

alexdowad commented May 10, 2023 via email

@alexdowad
Copy link
Contributor

Looks good to me. Thanks very much, @iluuu1994.

Sorry that I took a couple days more than expected to get to this.

@iluuu1994 iluuu1994 closed this in aa553af May 15, 2023
@iluuu1994
Copy link
Member Author

@alexdowad No worries, there's are rarely a hurry. 🙂

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

Successfully merging this pull request may close these issues.

Segfault in mb_strrpos / mb_strripos when using negative offset and ASCII encoding
3 participants