diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-29 16:03:44 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-29 16:05:11 +0100 |
commit | 560ff9725e6fb05942dd0c891c8a4496c57bcb4b (patch) | |
tree | 0e9edb80df73c6217e0de294a64b92715a4ffde2 | |
parent | 392ad206a4f63fedf61d8086e390c73de8b72767 (diff) | |
download | php-git-560ff9725e6fb05942dd0c891c8a4496c57bcb4b.tar.gz |
Reset MBREX(search_re) in RSHUTDOWN
This is going to cause a segfault if reused in the next request.
To illustrate the issue, run these two scripts in sequence with
the built-in server:
// script1.php
mb_ereg_search_init('foobar');
mb_ereg_search('foo');
// script2.php
var_dump(mb_ereg_search_init("foobar"));
var_dump(mb_ereg_search_pos());
-rw-r--r-- | ext/mbstring/php_mbregex.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index aa1eec1686..b6ed2b86e9 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -149,6 +149,7 @@ PHP_RSHUTDOWN_FUNCTION(mb_regex) ZVAL_UNDEF(&MBREX(search_str)); } MBREX(search_pos) = 0; + MBREX(search_re) = NULL; if (MBREX(search_regs) != NULL) { onig_region_free(MBREX(search_regs), 1); |