summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2019-08-08 17:27:14 +0100
committerKarl Williamson <khw@cpan.org>2021-05-31 08:05:43 -0600
commit8227b2b69230eaeea8f88d757b20021608518279 (patch)
tree53f104c12c33fb81751d412b58d479299e41d8b6 /regcomp.c
parente096e509321e540009a195ee8530c7dd07c62125 (diff)
downloadperl-8227b2b69230eaeea8f88d757b20021608518279.tar.gz
[gh 17847] data->pos_delta should stick at infinity
The expression we're about to add to data->pos_delta in this part of study_chunk() can be both positive or negative; however while we apply an overflow check to avoid exceeding OPTIMIZE_INFTY, we were happily subtracting from it when the expression was negative, making it no longer infinite.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 81fdffca73..82fa2c07a5 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5842,6 +5842,7 @@ Perl_re_printf( aTHX_ "LHS=%" UVuf " RHS=%" UVuf "\n",
- minnext * mincount), (UV)(OPTIMIZE_INFTY - data->pos_delta));
#endif
if (deltanext == OPTIMIZE_INFTY
+ || data->pos_delta == OPTIMIZE_INFTY
|| -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= OPTIMIZE_INFTY - data->pos_delta)
data->pos_delta = OPTIMIZE_INFTY;
else