Re: PCRE JIT stack size limit

From: Date: Fri, 24 Jul 2015 08:14:05 +0000
Subject: Re: PCRE JIT stack size limit
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-87263@lists.php.net to get a copy of this message
On Jul 24, 2015 10:34 AM, "Adam Harvey" <aharvey@php.net> wrote: > > On 23 July 2015 at 11:47, Christoph Becker <cmbecker69@gmx.de> wrote: > <snip great explanation, thanks> > > Therefore I tend to prefer a new ini setting (say, pcre.jitstack_limit). > > That would mean, however, to add yet another ini setting, of which > > there are already so many. > > I'm not a big fan of that, although it's at least in the spirit of > what configuration settings are meant to be used for. > > What if we added the PCRE_ERROR_JIT_STACKLIMIT error constant to those > exposed to userland so that it's more easily noticed via > preg_last_error(), and adding a modifier that can be used to disable > the JIT on a per-pattern basis (by setting PCRE_NO_START_OPTIMIZE, > which admittedly disables other stuff too, but at least the regex will > run)? At least then users could check the error when the regex fails > and re-run the regex without the JIT if they chose to. > > How likely is the average user to hit this, do you think? I am not sure we have accurate numbers or can have. It really depends on the expressions. A simple one can exhaust the stack as much as a apparently more complex expressions. I have to say that the default stack we use now on windows has reduced the amount of bug reports. I do not think we can eliminate it and increase it too much may bring some bad side effects as well.

« previous php.internals (#87263) next »