summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index a521ae3013..84f2670e6d 100644
--- a/regexec.c
+++ b/regexec.c
@@ -9316,7 +9316,10 @@ NULL
/* avoid taking address of locinput, so it can remain
* a register var */
char *li = locinput;
- ST.count = regrepeat(rex, &li, ST.A, loceol, reginfo, ST.max);
+ if (ST.max)
+ ST.count = regrepeat(rex, &li, ST.A, loceol, reginfo, ST.max);
+ else
+ ST.count = 0;
if (ST.count < ST.min)
sayNO;
SET_locinput(li);
@@ -10058,6 +10061,8 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
unsigned int to_complement = 0; /* Invert the result? */
char_class_number_ classnum;
+ assert(max);
+
PERL_ARGS_ASSERT_REGREPEAT;
/* This routine is structured so that we switch on the input OP. Each OP