Skip to content

Commit

Permalink
[gh 17847] data->pos_delta should stick at infinity
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hvds committed May 4, 2021
1 parent 0a065f3 commit c14c117
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions regcomp.c
Expand Up @@ -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
Expand Down

0 comments on commit c14c117

Please sign in to comment.