develooper Front page | perl.perl5.porters | Postings from March 2003

Re: Parse::RecDescent triggers infinete loop in perl5.9.0 and 5.8.1 [perl #17757]

From:
Inaba Hiroto
Date:
March 21, 2003 00:31
Subject:
Re: Parse::RecDescent triggers infinete loop in perl5.9.0 and 5.8.1 [perl #17757]
Message ID:
3E7ACEC8.E0D57221@st.rim.or.jp
Enache Adrian wrote:

> On Fri, Mar 21, 2003 at 12:29:18AM +0000, hv@crypt.org wrote:
> > It hasn't been established yet precisely what is going wrong, but it
> > seems likely based on available evidence that #18533 was either wrong
> > or insufficient. In particular, given that the symptom is a hard loop
> > in intuit_start, it seems unlikely that P::RD is to blame. I'll be
> > looking to discover more detail as soon as a tuit presents itself.
> >
> > Hugo

I think attached patch will adjust the #18533.

> The faulty regexp in RecDescent.pm is this, at line 1856
>                 elsif ($grammar =~ m/(?=$ACTION)/gco
>
> The second time the _generate method runs, fbm_instr() will be called
> at regexec.c:622 with a random pointer as it second argument, pointer
> generated with some small adjustments from that prog->subbeg -
>         if (s && RX_MATCH_COPIED(prog))
>                     s = prog->subbeg + (s - SvPVX(sv));
> (the stale pointer from the first run, I guess (?) - notice
>  that the grammar string in the example is a mortal, returned
>  by a sub, i.e. it is each time a different pointer )
>
> If that pointer happens to be behind 't', an infinite loop happens.

 I failed to make small test for the problem.
--
    Inaba Hiroto    <inaba@st.rim.or.jp>




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About