Skip to content

Commit

Permalink
Apply upstream patch for CVE-2016-1283
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Sep 28, 2017
1 parent 29e673f commit d11fcea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ext/pcre/pcrelib/pcre_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
10 changes: 10 additions & 0 deletions ext/pcre/tests/bug75207.phpt
Original file line number Diff line number Diff line change
@@ -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==

0 comments on commit d11fcea

Please sign in to comment.