Skip to content

Commit db9778d

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Apply upstream patch for CVE-2016-1283
2 parents 72c008f + d11fcea commit db9778d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ext/pcre/pcrelib/pcre_compile.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7272,7 +7272,12 @@ for (;; ptr++)
72727272
so far in order to get the number. If the name is not found, leave
72737273
the value of recno as 0 for a forward reference. */
72747274

7275-
else
7275+
/* This patch (removing "else") fixes a problem when a reference is
7276+
to multiple identically named nested groups from within the nest.
7277+
Once again, it is not the "proper" fix, and it results in an
7278+
over-allocation of memory. */
7279+
7280+
/* else */
72767281
{
72777282
ng = cd->named_groups;
72787283
for (i = 0; i < cd->names_found; i++, ng++)

ext/pcre/tests/bug75207.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
CVE-2016-1283, see bug #75207
3+
--FILE--
4+
<?php
5+
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");
6+
?>
7+
==DONE==
8+
--EXPECTF--
9+
Warning: preg_match(): Compilation failed: unmatched parentheses at offset %d in %s on line %d
10+
==DONE==

0 commit comments

Comments
 (0)