summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-01-09 20:37:28 +0100
committerYves Orton <demerphq@gmail.com>2023-01-15 17:21:03 +0100
commit5c6240fadac873b60c46677b4d5b180f4fb6074b (patch)
treece9346482bac081a0cbfd59d2edc2610c740c2d5 /regexec.c
parent37040543d024b3ecb0aecd78849bd5af61408d02 (diff)
downloadperl-5c6240fadac873b60c46677b4d5b180f4fb6074b.tar.gz
regexec.c - fix accept in CURLYX/WHILEM construct.
The ACCEPT logic didnt know how to handle WHILEM, which for some reason does not have a next_off defined. I am not sure why. This was revealed by forcing CURLYX optimisations off. This includes a patch to test what happens if we embed an eval group in the tests run by regexp.t when run via regexp_normal.t, which disabled CURLYX -> CURLYN and CURLYM optimisations and revealed this issue. This adds t/re/regexp_normal.t which test "normalized" forms of the patterns in t/re/re_tests by munging them in various ways to see if they still behave as expected. For instance injecting a (?{}) can disable optimisations.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index d2c020feb2..a022098380 100644
--- a/regexec.c
+++ b/regexec.c
@@ -8527,7 +8527,10 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
for (
cursor = scan;
cursor && ( OP(cursor) != END );
- cursor = ( REGNODE_TYPE( OP(cursor) ) == END )
+ cursor = (
+ REGNODE_TYPE( OP(cursor) ) == END
+ || REGNODE_TYPE( OP(cursor) ) == WHILEM
+ )
? REGNODE_AFTER(cursor)
: regnext(cursor)
){
@@ -8741,7 +8744,6 @@ NULL
);
/* First just match a string of min A's. */
-
if (n < min) {
ST.cp = regcppush(rex, cur_curlyx->u.curlyx.parenfloor, maxopenparen);
cur_curlyx->u.curlyx.lastloc = locinput;