com php-src: Fixed Bug #69883 (Compilation failed on PCRE): ext/pcre/php_pcre.c

From: Date: Fri, 19 Jun 2015 12:33:14 +0000
Subject: com php-src: Fixed Bug #69883 (Compilation failed on PCRE): ext/pcre/php_pcre.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87389@lists.php.net to get a copy of this message
Commit: 05c24d5dfa4719c4f15948ffd74f5266c60a4d67 Author: Xinchen Hui <laruence@php.net> Fri, 19 Jun 2015 20:33:14 +0800 Parents: 1e65b65dd683612925d99202c45ed8ed410edbde Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=05c24d5dfa4719c4f15948ffd74f5266c60a4d67 Log: Fixed Bug #69883 (Compilation failed on PCRE) Bugs: https://bugs.php.net/69883 Changed paths: M ext/pcre/php_pcre.c Diff: diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 2d75bc2..11b74b4 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1082,7 +1082,11 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su /* Calculate the size of the offsets array, and allocate memory for it. */ num_subpats = pce->capture_count + 1; size_offsets = num_subpats * 3; - offsets = (int *)do_alloca_ex(size_offsets * sizeof(int), 32 * sizeof(int), use_heap); + if (size_offsets <= 32) { + offsets = (int *)do_alloca(size_offsets * sizeof(int), use_heap); + } else { + offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0); + } /* * Build a mapping from subpattern numbers to their names. We will @@ -1279,7 +1283,11 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su start_offset = offsets[1]; } - free_alloca(offsets, use_heap); + if (size_offsets <= 32) { + free_alloca(offsets, use_heap); + } else { + efree(offsets); + } if (UNEXPECTED(subpat_names)) { efree(subpat_names); }

« previous php.cvs (#87389) next »