diff options
author | Yves Orton <demerphq@gmail.com> | 2010-06-19 13:41:10 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2010-06-24 18:51:40 +0200 |
commit | c941595168829d86ac7d2e0fa00a891d42f5d96e (patch) | |
tree | 06b841700980831c832be20f7c038c17b96e358f /regexec.c | |
parent | 2c33c7677d07b611b2eedbfa2f6b0b56a17ef91b (diff) | |
download | perl-c941595168829d86ac7d2e0fa00a891d42f5d96e.tar.gz |
when disabling regex implicit check string we must reset anchored flag
It seems that if a regex check string is determined to be "not useful"
it is permananently disabled. However, it appears that when doing this
we dont necessarily reset any flags that are related to it.
Worse, the behaviour is not determinisitic, so it is quite possible that
a given program may experience this bug "randomly" based on what strings
it was matching. Thus it may be difficult to reproduce.
Resetting the RXc_ANCH_MBOL when we know that it is implicit
(PREGf_IMPLICIT) seems to fix /this/ particular example. But it wouldn't
surprise me to discover that other "random" bugs we encounter can be
traced back to this behaviour.
This fixes RT #75878 which is derived from ActiveState Bug #87173.
http://bugs.activestate.com/show_bug.cgi?id=87173
http://rt.perl.org/rt3/Ticket/Display.html?id=75878
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -994,10 +994,15 @@ Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos, prog->float_substr = prog->float_utf8 = NULL; /* clear */ check = NULL; /* abort */ s = strpos; + /* XXXX If the check string was an implicit check MBOL, then we need to unset the relevent flag + see http://bugs.activestate.com/show_bug.cgi?id=87173 */ + if (prog->intflags & PREGf_IMPLICIT) + prog->extflags &= ~RXf_ANCH_MBOL; /* XXXX This is a remnant of the old implementation. It looks wasteful, since now INTUIT can use many other heuristics. */ prog->extflags &= ~RXf_USE_INTUIT; + /* XXXX What other flags might need to be cleared in this branch? */ } else s = strpos; |