diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-07 12:30:43 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-07 12:30:43 +0200 |
commit | f4b2497ad8c366d276689dd1c7e3a84c33c11d9b (patch) | |
tree | 91f657c480f18197c292739e78fb5a34e53bc742 /ext/pcre/php_pcre.h | |
parent | 9475bcbef77c5e87d0381943ab0194f720b1323c (diff) | |
download | php-git-f4b2497ad8c366d276689dd1c7e3a84c33c11d9b.tar.gz |
Allocate temporary PCRE match data using ZMM
Create a separate general context that uses ZMM as allocator and
use it to allocate temporary PCRE match data (there is still one
global match data). There is no requirement that the match data
and the compiled regex / match context use the same general context.
This makes sure that we do not leak persistent memory on bailout
and fixes oss-fuzz #25296, on which half the libfuzzer runs
currently get stuck.
Diffstat (limited to 'ext/pcre/php_pcre.h')
-rw-r--r-- | ext/pcre/php_pcre.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index 808b671bb8..e9f5e34ab9 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -84,6 +84,8 @@ ZEND_BEGIN_MODULE_GLOBALS(pcre) /* Used for unmatched subpatterns in OFFSET_CAPTURE mode */ zval unmatched_null_pair; zval unmatched_empty_pair; + /* General context using per-request allocator (ZMM). */ + pcre2_general_context *gctx_zmm; ZEND_END_MODULE_GLOBALS(pcre) PHPAPI ZEND_EXTERN_MODULE_GLOBALS(pcre) |