com php-src: Apply upstream patch for CVE-2016-1283: ext/pcre/pcrelib/pcre_compile.c ext/pcre/tests/bug75 207.phpt
| From: | Anatol Belski | Date: | Thu, 28 Sep 2017 13:40:49 +0000 |
| Subject: | com php-src: Apply upstream patch for CVE-2016-1283: ext/pcre/pcrelib/pcre_compile.c ext/pcre/tests/bug75 207.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99571@lists.php.net to get a copy of this message | ||
Commit: d11fceab151cd0410645f81eb7444af4388470c3
Author: Anatol Belski <ab@php.net> Thu, 28 Sep 2017 15:40:49 +0200
Parents: 29e673f8ede348eac6bc4e23c91c37240f480f4d
Branches: PHP-7.0 PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d11fceab151cd0410645f81eb7444af4388470c3
Log:
Apply upstream patch for CVE-2016-1283
Fix bug #75207, see also
https://bugzilla.redhat..com/show_bug.cgi?id=1295385
https://vcs.pcre.org/pcre?view=revision&revision=1636
Bugs:
https://bugs.php.net/75207
Changed paths:
M ext/pcre/pcrelib/pcre_compile.c
A ext/pcre/tests/bug75207.phpt
Diff:
diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c
index 11a9d26..c782774 100644
--- a/ext/pcre/pcrelib/pcre_compile.c
+++ b/ext/pcre/pcrelib/pcre_compile.c
@@ -7272,7 +7272,12 @@ for (;; ptr++)
so far in order to get the number. If the name is not found, leave
the value of recno as 0 for a forward reference. */
- else
+ /* This patch (removing "else") fixes a problem when a reference is
+ to multiple identically named nested groups from within the nest.
+ Once again, it is not the "proper" fix, and it results in an
+ over-allocation of memory. */
+
+ /* else */
{
ng = cd->named_groups;
for (i = 0; i < cd->names_found; i++, ng++)
diff --git a/ext/pcre/tests/bug75207.phpt b/ext/pcre/tests/bug75207.phpt
new file mode 100644
index 0000000..dea13a4
--- /dev/null
+++ b/ext/pcre/tests/bug75207.phpt
@@ -0,0 +1,10 @@
+--TEST--
+CVE-2016-1283, see bug #75207
+--FILE--
+<?php
+preg_match("/(?:F?+(?:^(?(R)a+\"){99}-))(?J)(?'R'(?'R'<((?'RR'(?'R'\){97)?J)?J)(?'R'(?'R'\){99|(:(?|(?'R')(\k'R')|((?'R')))H'R'R)(H'R))))))/",
"*b\dc");
+?>
+==DONE==
+--EXPECTF--
+Warning: preg_match(): Compilation failed: unmatched parentheses at offset %d in %s on line %d
+==DONE==