diff options
author | Anatol Belski <ab@php.net> | 2018-06-29 19:11:02 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-06-29 19:15:38 +0200 |
commit | ff8f2710f6eab21888223fac3a8d8a8d4549d201 (patch) | |
tree | 8de106a5e0b7686b434fadc3cd3fa029779d8150 /ext/pcre/php_pcre.c | |
parent | 4ff6c0cb447e55522ccb40fe18547c79727dbb73 (diff) | |
download | php-git-ff8f2710f6eab21888223fac3a8d8a8d4549d201.tar.gz |
Check return value of pcre2_maketables()
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index e46c83accc..c365c9f475 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -720,6 +720,13 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string)); if (!tables) { tables = pcre2_maketables(gctx); + if (UNEXPECTED(!tables)) { + php_error_docref(NULL,E_WARNING, "Failed to generate locale character tables"); + pcre_handle_exec_error(PCRE2_ERROR_NOMEMORY); + zend_string_release_ex(key, 0); + efree(pattern); + return NULL; + } zend_hash_add_ptr(&char_tables, BG(locale_string), (void *)tables); } pcre2_set_character_tables(cctx, tables); |