File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ static const char error_texts[] =
483483 "lookbehind assertion is not fixed length\0"
484484 "malformed number or name after (?(\0"
485485 "conditional group contains more than two branches\0"
486- "assertion expected after (?(\0"
486+ "assertion expected after (?( or (?(?C) \0"
487487 "(?R or (?[+-]digits must be followed by )\0"
488488 /* 30 */
489489 "unknown POSIX class name\0"
@@ -6732,6 +6732,15 @@ for (;; ptr++)
67326732 for (i = 3 ;; i ++ ) if (!IS_DIGIT (ptr [i ])) break ;
67336733 if (ptr [i ] == CHAR_RIGHT_PARENTHESIS )
67346734 tempptr += i + 1 ;
6735+
6736+ /* tempptr should now be pointing to the opening parenthesis of the
6737+ assertion condition. */
6738+
6739+ if (* tempptr != CHAR_LEFT_PARENTHESIS )
6740+ {
6741+ * errorcodeptr = ERR28 ;
6742+ goto FAILED ;
6743+ }
67356744 }
67366745
67376746 /* For conditions that are assertions, check the syntax, and then exit
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Bug #75457 (heap-use-after-free in php7.0.25)
3+ --FILE--
4+ <?php
5+ $ pattern = "/(((?(?C)0?=))(?!()0|.(?0)0)())/ " ;
6+ var_dump (preg_match ($ pattern , "hello " ));
7+ ?>
8+ --EXPECTF--
9+ Warning: preg_match(): Compilation failed: assertion expected after (?( or (?(?C) at offset 4 in %sbug75457.php on line %d
10+ bool(false)
You can’t perform that action at this time.
0 commit comments