In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/77eddfe1ca901cdf5a01ed0f5b9f1db812410513?hp=c24d0595c9166aecac9842f4195f1d967468fd5a>
- Log ----------------------------------------------------------------- commit 77eddfe1ca901cdf5a01ed0f5b9f1db812410513 Author: Karl Williamson <[email protected]> Date: Wed Mar 2 10:50:01 2016 -0700 PATCH: [perl #127599] Fix regcomp.c assertion I added this assertion in cfbef7dc3. It asserts that we have more to parse. The code in this function is quite complicated, and assumes in a number of places that there is more to parse. When we don't have more to parse, 900 lines later, it throws an error. It may be that you can't get to the places where it assumes there is more to parse if this assertion is false (I don't remember now from my tedious audit of this code), but even if so, it is fragile to assume so, given the large distance to where the error is thrown. So throw the error right away and avoid any existing or future breakage. ----------------------------------------------------------------------- Summary of changes: regcomp.c | 4 +++- t/re/reg_mesg.t | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/regcomp.c b/regcomp.c index 46b9f77..bbb998f 100644 --- a/regcomp.c +++ b/regcomp.c @@ -10313,7 +10313,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth) * indivisible */ bool has_intervening_patws = paren == 2 && *(RExC_parse - 1) != '('; - assert(RExC_parse < RExC_end); + if (RExC_parse >= RExC_end) { + vFAIL("Unmatched ("); + } if ( *RExC_parse == '*') { /* (*VERB:ARG) */ char *start_verb = RExC_parse + 1; diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t index 0763be0..7509f41 100644 --- a/t/re/reg_mesg.t +++ b/t/re/reg_mesg.t @@ -146,6 +146,7 @@ my @death = '/(?i-l:foo)/' => 'Regexp modifier "l" may not appear after the "-" {#} m/(?i-l{#}:foo)/', '/((x)/' => 'Unmatched ( {#} m/({#}(x)/', + '/{(}/' => 'Unmatched ( {#} m/{({#}}/', # [perl #127599] "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 {#} m/x{{#}$inf_p1}/", -- Perl5 Master Repository
