summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-04-09 20:22:34 -0600
committerKarl Williamson <khw@cpan.org>2019-04-09 20:26:25 -0600
commitb92b2705fea1ae06e2e671bfdd4d52927df528a5 (patch)
tree71d78824a3987860b1f924a4798f115b296f1e37 /regexec.c
parent0a5ed81e6617c9229cc1ea042e9a70c3ec63fd65 (diff)
downloadperl-b92b2705fea1ae06e2e671bfdd4d52927df528a5.tar.gz
PATCH: [perl #133999] Assertion failure in regex match
This was caused by failing to limit matching to within the bounds of the target string. I'm pretty sure this bug has long been there, but was exposed by the recently added wildcard property matching feature.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/regexec.c b/regexec.c
index 48ed8c3524..bd6e4b9d96 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1972,9 +1972,12 @@ STMT_START {
}
/* This is the macro to use when we want to see if something that looks like it
- * could match, actually does, and if so exits the loop */
-#define REXEC_FBC_TRYIT \
- if ((reginfo->intuit || regtry(reginfo, &s))) \
+ * could match, actually does, and if so exits the loop. It needs to be used
+ * only for bounds checking macros, as it allows for matching beyond the end of
+ * string (which should be zero length without having to look at the string
+ * contents) */
+#define REXEC_FBC_TRYIT \
+ if ((reginfo->intuit || (s <= reginfo->strend && regtry(reginfo, &s)))) \
goto got_it
/* The only difference between the BOUND and NBOUND cases is that