From: Stanislav Malyshev Date: Mon, 3 Nov 2014 19:40:15 +0000 (-0800) Subject: Merge branch 'PHP-5.6' X-Git-Tag: PRE_PHP7_REMOVALS~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf59acdea75cf13d179f10ce89d296a30f38676d;p=php 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 --- bf59acdea75cf13d179f10ce89d296a30f38676d diff --cc ext/pcre/php_pcre.c index 918214edb1,55aa3de2e5..6f9f2aebbf --- 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