summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regcomp.c7
-rw-r--r--t/re/re_tests2
2 files changed, 8 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index bea1348d67..2109b6a403 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5224,7 +5224,12 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
* might result in a minlen of 1 and not of 4,
* but this doesn't make us mismatch, just try a bit
* harder than we should.
- * */
+ *
+ * However we must assume this GOSUB is infinite, to
+ * avoid wrongly applying other optimizations in the
+ * enclosing scope - see GH 18096, for example.
+ */
+ is_inf = is_inf_internal = 1;
scan= regnext(scan);
continue;
}
diff --git a/t/re/re_tests b/t/re/re_tests
index 9304bd78b1..c6f73d805b 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -2023,6 +2023,8 @@ AB\s+\x{100} AB \x{100}X y - -
/(?iaax:A? \K +)/ African_Feh c - \\K + is forbidden - matches null string many times in regex
/(?iaa:A?\K+)/ African_Feh c - \\K+ is forbidden - matches null string many times in regex
/(?iaa:A?\K*)/ African_Feh c - \\K* is forbidden - matches null string many times in regex
+^((\w|<(\s)*(?1)(?3)*>)(?:(?3)*\+(?3)*(?2))*)(?3)*\+ a + b + <c + d> y $1 a + b # [GH #18096]
+^((\w|<(\s)*(?1)(?3)*>)(?:(?3)*\+(?3)*(?2))*)(?3)*\+ a + <b> + c y $1 a + <b> # [GH #18096]
# Keep these lines at the end of the file
# pat string y/n/etc expr expected-expr skip-reason comment
# vim: softtabstop=0 noexpandtab