summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 793201ca49..bdc05af088 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3990,7 +3990,9 @@ S_regrepeat(pTHX_ regnode *p, I32 max)
register bool do_utf8 = PL_reg_match_utf8;
scan = PL_reginput;
- if (max != REG_INFTY && max < loceol - scan)
+ if (max == REG_INFTY)
+ max = I32_MAX;
+ else if (max < loceol - scan)
loceol = scan + max;
switch (OP(p)) {
case REG_ANY: