PCRE and recursion: NO_RECURSE flag
| From: | Arnaud Le Blanc | Date: | Thu, 07 Aug 2008 12:24:04 +0000 |
| Subject: | PCRE and recursion: NO_RECURSE flag | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-39730@lists.php.net to get a copy of this message | ||
Hi,
PCRE can be highly recursive [1] and this can cause segmentation faults [2].
This is a known problem and the pcre ini settings avoids the segfaults, but
the execution of the expression will fail anyway.
PCRE has a NO_RECURSE flag which makes the match() internal function no
recursive and avoids this problem. The configure switch for this option is --
disable-stack-for-recursion. NO_RECURSE is documented in pcre_exec.c.
This can be easily enabled [3] for the bundled PCRE. It seems to be safe to
enable that. Actually the PCRE test suite pass with NO_RECURSE enabled, and
segfaults without. Can this be enabled ?
[1] http://manpages.courier-mta.org/htmlman3/pcrestack.3.html
[2] http://bugs.php.net/bug.php?id=45735
[3] http://arnaud.lb.s3.amazonaws.com/pcre_no_recurse.patch
Regards,
Arnaud