-
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
Segmentation fault in mb_strimwidth() #9248
Comments
Girgias
added
Extension: mbstring
Status: Verified
and removed
Status: Needs Triage
labels
Aug 4, 2022
Indeed, we need to initialize ext/mbstring/mbstring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index b9cfe628b4..24712c8817 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2502,7 +2502,7 @@ static zend_string* mb_trim_string(zend_string *input, zend_string *marker, cons
/* Trim the string to terminal width; optional, add a 'trim marker' if it was truncated */
PHP_FUNCTION(mb_strimwidth)
{
- zend_string *str, *trimmarker, *encoding = NULL;
+ zend_string *str, *trimmarker = zend_empty_string, *encoding = NULL;
zend_long from, width;
ZEND_PARSE_PARAMETERS_START(3, 5) |
Thanks for the great catch! Much appreciated! |
@cmb69, do you want to commit this fix, or should I include it in my next PR? |
cmb69
added a commit
to cmb69/php-src
that referenced
this issue
Aug 8, 2022
We need to initialize the optional argument `trimmarker` with its default value.
I just submitted PR #9273. :) |
Thanks very much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
Process crashed with SIGSEGV.
But I expected this output instead:
PHP Version
git.master | released 2022-08-04 (3v4l.org)
Operating System
No response
The text was updated successfully, but these errors were encountered: