com php-src: Merge branch 'PHP-5.6': ext/pcre/php_pcre.c
| From: | Stanislav Malyshev | Date: | Mon, 03 Nov 2014 19:40:15 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82939@lists.php.net to get a copy of this message | ||
Commit: bf59acdea75cf13d179f10ce89d296a30f38676d
Author: Stanislav Malyshev <stas@php.net> Mon, 3 Nov 2014 11:40:15 -0800
Parents: a8be707bf11f92141a7e2cdb293249fb903846f8 90ba99a2c21bc78174741da2b076cc5c3826526c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bf59acdea75cf13d179f10ce89d296a30f38676d
Log:
Merge branch 'PHP-5.6'
* PHP-5.6:
Initialize the offset table - PCRE may sometimes miss offsets
set default response code to 200
set default response code to 200
set default response code to 200
fix NEWS & version
NEWS
Fix bug #68283: fileinfo: out-of-bounds read in elf note headers
Fix bug #68113 (Heap corruption in exif_thumbnail())
Fix bug #68089 - do not accept options with embedded \0
Fixed bug #68044: Integer overflow in unserialize() (32-bits only)
Fix bug #68027 - fix date parsing in XMLRPC lib
Conflicts:
ext/pcre/php_pcre.c
Bugs:
https://bugs.php.net/68283
https://bugs.php.net/68113
https://bugs.php.net/68089
https://bugs.php.net/68044
https://bugs.php.net/68027
Changed paths:
MM ext/pcre/php_pcre.c
Diff:
diff --cc ext/pcre/php_pcre.c
index 918214e,55aa3de..6f9f2ae
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@@ -652,28 -636,24 +652,28 @@@ PHPAPI void php_pcre_match_impl(pcre_ca
size_offsets = num_subpats * 3;
/*
- * Build a mapping from subpattern numbers to their names. We will always
- * allocate the table, even though there may be no named subpatterns. This
- * avoids somewhat more complicated logic in the inner loops.
+ * Build a mapping from subpattern numbers to their names. We will
+ * allocate the table only if there are any named subpatterns.
*/
- subpat_names = make_subpats_table(num_subpats, pce TSRMLS_CC);
- if (!subpat_names) {
- RETURN_FALSE;
+ subpat_names = NULL;
+ if (pce->name_count > 0) {
+ subpat_names = make_subpats_table(num_subpats, pce TSRMLS_CC);
+ if (!subpat_names) {
+ RETURN_FALSE;
+ }
}
- offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
+ if (size_offsets <= 32) {
+ offsets = (int *)do_alloca(size_offsets * sizeof(int), use_heap);
+ } else {
+ offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
+ }
-
+ memset(offsets, 0, size_offsets*sizeof(int));
/* Allocate match sets array and initialize the values. */
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
- match_sets = (zval **)safe_emalloc(num_subpats, sizeof(zval *), 0);
+ match_sets = (zval *)safe_emalloc(num_subpats, sizeof(zval), 0);
for (i=0; i<num_subpats; i++) {
- ALLOC_ZVAL(match_sets[i]);
- array_init(match_sets[i]);
- INIT_PZVAL(match_sets[i]);
+ array_init(&match_sets[i]);
}
}