[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] com php-src: Check return value of =?UTF-8?Q?pcre=32=5Fmaketables=28=29?= =?UTF-8?Q?=3A=20
From:       Anatol Belski <ab () php ! net>
Date:       2018-06-29 17:15:38
Message-ID: php-mail-a69715ffcf01f24c67cf0aed7c4d6300106768571 () git ! php ! net
[Download RAW message or body]

Commit:    ff8f2710f6eab21888223fac3a8d8a8d4549d201
Author:    Anatol Belski <ab@php.net>         Fri, 29 Jun 2018 19:11:02 +0200
Parents:   4ff6c0cb447e55522ccb40fe18547c79727dbb73
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=ff8f2710f6eab21888223fac3a8d8a8d4549d201

Log:
Check return value of pcre2_maketables()

Changed paths:
  M  ext/pcre/php_pcre.c


Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index e46c83a..c365c9f 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);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic