diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-29 12:50:47 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-29 12:50:47 +0100 |
commit | 42e22a2d918a46efdb4a2e146c1aee7371118426 (patch) | |
tree | dd9f9a6017d5ab5f2db2ba07daf369108621f52e /ext/mbstring/php_mbregex.c | |
parent | 7d2ef3d2e540885dec26d91dad061bff1621ad07 (diff) | |
parent | b3f07afabc32cef19c092524fd705ca1cbde566b (diff) | |
download | php-git-42e22a2d918a46efdb4a2e146c1aee7371118426.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Fix use of mb_ereg_search_getregs() after invalid pattern
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r-- | ext/mbstring/php_mbregex.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 3a49bc8614..d7c236fd4a 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -1405,6 +1405,11 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) _php_mb_regex_init_options(arg_options, arg_options_len, &option, &syntax, NULL); } + if (MBREX(search_regs)) { + onig_region_free(MBREX(search_regs), 1); + MBREX(search_regs) = NULL; + } + if (arg_pattern) { /* create regex pattern buffer */ if ((MBREX(search_re) = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), MBREX(regex_default_syntax))) == NULL) { @@ -1430,9 +1435,6 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) RETURN_FALSE; } - if (MBREX(search_regs)) { - onig_region_free(MBREX(search_regs), 1); - } MBREX(search_regs) = onig_region_new(); err = _php_mb_onig_search(MBREX(search_re), str, str + len, str + pos, str + len, MBREX(search_regs), 0); |