]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.1' into PHP-7.2
authorAnatol Belski <ab@php.net>
Tue, 5 Dec 2017 17:34:39 +0000 (18:34 +0100)
committerAnatol Belski <ab@php.net>
Tue, 5 Dec 2017 17:34:39 +0000 (18:34 +0100)
* PHP-7.1:
  Fix use after free revealed by phpdbg

1  2 
ext/pcre/php_pcre.c

index 64db5da0f6742f0d2e917e3801a93b11047d859f,a743f30b049f19a875d2ddd61a403614658018a4..5ec7f4d9026ecf8208639b9a0768101398a68ca9
@@@ -70,8 -69,8 +70,8 @@@ ZEND_TLS pcre_jit_stack *jit_stack = NU
  #endif
  #if defined(ZTS) && defined(HAVE_PCRE_JIT_SUPPORT)
  static MUTEX_T pcre_mt = NULL;
 -#define php_pcre_mutex_alloc() if (!pcre_mt) pcre_mt = tsrm_mutex_alloc();
 -#define php_pcre_mutex_free() if (pcre_mt) tsrm_mutex_free(pcre_mt); 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);
++#define php_pcre_mutex_free() if (tsrm_is_main_thread() && pcre_mt) tsrm_mutex_free(pcre_mt); pcre_mt = NULL;
  #define php_pcre_mutex_lock() tsrm_mutex_lock(pcre_mt);
  #define php_pcre_mutex_unlock() tsrm_mutex_unlock(pcre_mt);
  #else