summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-12-21 11:04:02 -0700
committerKarl Williamson <khw@cpan.org>2020-12-21 11:09:35 -0700
commit1a7ee1dc1e657347ff0fa95272f0cbecbfca421f (patch)
tree2a71de235a31bd613deb4054317c8a160465a51b /regexec.c
parent2f338e940005dc728823c28fe6289f055e27f853 (diff)
downloadperl-1a7ee1dc1e657347ff0fa95272f0cbecbfca421f.tar.gz
regexec.c: Fix failing CI 32-bit tests
This bug was introduced by bb3825626ed2b1217a2ac184eff66d0d4ed6e070, and was the result of overflowing a 32 bit space. The solution is to rework the expression so that it can't overflow.
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 74f95e73d0..61a3075cc2 100644
--- a/regexec.c
+++ b/regexec.c
@@ -10019,7 +10019,9 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
if (definitive_len == 1) {
const char * orig_scan = scan;
- this_eol = MIN(this_eol, scan + max - hardcount);
+ if (this_eol - (scan - hardcount) > max) {
+ this_eol = scan - hardcount + max;
+ }
/* Use different routines depending on whether it's an
* exact match or matches with a mask */