Re: PCRE and recursion: NO_RECURSE flag

From: Date: Thu, 07 Aug 2008 12:35:12 +0000
Subject: Re: PCRE and recursion: NO_RECURSE flag
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-39731@lists.php.net to get a copy of this message
No! Last time I benchmark it, it has about 100x slower, so I don't think so.. If you need to match large amounts of data, just increase the stack size. ulimit is your friend :) Nuno ----- Original Message ----- From: "Arnaud Le Blanc" <arnaud.lb@gmail.com> To: <internals@lists.php.net> Sent: Thursday, August 07, 2008 1:24 PM Subject: [PHP-DEV] PCRE and recursion: NO_RECURSE flag
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


« previous php.internals (#39731) next »