Skip to content

Commit

Permalink
regcomp: use long jumps if there is any possibility of overflow
Browse files Browse the repository at this point in the history
(CVE-2020-10878) Be conservative for backporting, we'll aim to do
something more aggressive for bleadperl.

(cherry picked from commit 9d7759db46f3b31b1d3f79c44266b6ba42a47fc6)
  • Loading branch information
khwilliamson authored and steve-m-hay committed May 17, 2020
1 parent 0a320d7 commit 3295b48
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7762,6 +7762,13 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,

/* We have that number in RExC_npar */
RExC_total_parens = RExC_npar;

/* XXX For backporting, use long jumps if there is any possibility of
* overflow */
if (RExC_size > U16_MAX && ! RExC_use_BRANCHJ) {
RExC_use_BRANCHJ = TRUE;
flags |= RESTART_PARSE;
}
}
else if (! MUST_RESTART(flags)) {
ReREFCNT_dec(Rx);
Expand Down

0 comments on commit 3295b48

Please sign in to comment.