diff options
author | Anatol Belski <ab@php.net> | 2017-12-06 16:04:22 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-12-06 16:04:22 +0100 |
commit | 57f33b4ce269bdd169332d945d85ca96587874b5 (patch) | |
tree | f2510ffeecf246f9417a5e0a50c7af1670a0366f /ext/pcre/php_pcre.c | |
parent | d4af2046372dd33e2364c6862ada3a9333f75907 (diff) | |
parent | 1b29dc0b1c4836085a17cbf2f59dae8aeb85424c (diff) | |
download | php-git-57f33b4ce269bdd169332d945d85ca96587874b5.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix yet one data race in PCRE
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 5ec7f4d902..2fb1133799 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -68,7 +68,7 @@ PHPAPI ZEND_DECLARE_MODULE_GLOBALS(pcre) #define PCRE_JIT_STACK_MAX_SIZE (64 * 1024) ZEND_TLS pcre_jit_stack *jit_stack = NULL; #endif -#if defined(ZTS) && defined(HAVE_PCRE_JIT_SUPPORT) +#if defined(ZTS) static MUTEX_T pcre_mt = NULL; #define php_pcre_mutex_alloc() if (tsrm_is_main_thread() && !pcre_mt) pcre_mt = tsrm_mutex_alloc(); #define php_pcre_mutex_free() if (tsrm_is_main_thread() && pcre_mt) tsrm_mutex_free(pcre_mt); pcre_mt = NULL; @@ -544,7 +544,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) /* If study option was specified, study the pattern and store the result in extra for passing to pcre_exec. */ if (do_study) { + php_pcre_mutex_lock(); extra = pcre_study(re, soptions, &error); + php_pcre_mutex_unlock(); if (extra) { extra->flags |= PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION; extra->match_limit = (unsigned long)PCRE_G(backtrack_limit); |