summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regexec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 5d31d735ff..56dfe121ab 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1833,6 +1833,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre
if (s > reginfo.ganch)
goto phooey;
s = reginfo.ganch - prog->gofs;
+ if (s < strbeg)
+ goto phooey;
}
}
else if (data) {
@@ -1915,7 +1917,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre
is bogus -- we set it above, when prog->extflags & RXf_GPOS_SEEN
and we only enter this block when the same bit is set. */
char *tmp_s = reginfo.ganch - prog->gofs;
- if (regtry(&reginfo, &tmp_s))
+
+ if (tmp_s >= strbeg && regtry(&reginfo, &tmp_s))
goto got_it;
goto phooey;
}