List Info

Thread: Re: Regexp recursion limit too low?




Re: Regexp recursion limit too low?
user name
2007-02-15 10:22:16
On 2/15/07, Robin Houston <robincpan.org> wrote:
> It seems to me that it should usually be easy to detect
infinite
> looping at run-time, without the need to impose a hard
limit on
> recursion depth.
>
> If the number of nested calls, without consuming any
input, exceeds
> the number of callable subexpressions in the pattern,
then we must be
> in a loop. (If I have passed 100 trees in a forest
containing 99
> trees, then I must have passed at least one of them
more than once,
> so my route must have contained a cycle.)

Attached patch uses a variant on this logic to set the max
recursion depth.

More specifically, it will set the max depth to be 3 times
the number
of capture buffers in the pattern, or the maxdepth,
whichever is
higher. It also sets the maxdepth to default to something a
little
more insane, instead of being 50 it set it to 1000.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

  
Re: Regexp recursion limit too low?
user name
2007-02-26 10:51:04
On 15/02/07, demerphq <demerphqgmail.com> wrote:
> > If the number of nested calls, without consuming
any input, exceeds
> > the number of callable subexpressions in the
pattern, then we must be
> > in a loop. (If I have passed 100 trees in a forest
containing 99
> > trees, then I must have passed at least one of
them more than once,
> > so my route must have contained a cycle.)
>
> Attached patch uses a variant on this logic to set the
max recursion depth.
>
> More specifically, it will set the max depth to be 3
times the number
> of capture buffers in the pattern, or the maxdepth,
whichever is
> higher. It also sets the maxdepth to default to
something a little
> more insane, instead of being 50 it set it to 1000.

Thanks, applied as #30412.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )