Skip to content

Commit

Permalink
PATCH: [perl #126404] Assertion fail in (?[...])
Browse files Browse the repository at this point in the history
This was due to the '()' in the test case being empty, and not reducing
to an operand.  The code didn't expect it, but was guarded by an
assertion.  Now it generates a proper error.
  • Loading branch information
khwilliamson committed Oct 20, 2015
1 parent a72f268 commit 174c990
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13807,8 +13807,12 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
/* Having gotten rid of the fence, we pop the operand at the
* stack top and process it as a newly encountered operand */
current = av_pop(stack);
assert(IS_OPERAND(current));
goto handle_operand;
if (IS_OPERAND(current)) {
goto handle_operand;
}

RExC_parse++;
goto bad_syntax;

case '&':
case '|':
Expand Down
1 change: 1 addition & 0 deletions t/re/reg_mesg.t
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ my @death =
'/((?# This is a comment in the middle of a token)*FAIL)/' => 'In \'(*VERB...)\', the \'(\' and \'*\' must be adjacent {#} m/((?# This is a comment in the middle of a token)*{#}FAIL)/',
'/(?[\ &!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[\ &!{#}])/', # [perl #126180]
'/(?[()-!])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[()-!{#}])/', # [perl #126204]
'/(?[!()])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[!(){#}])/', # [perl #126404]
);

# These are messages that are warnings when not strict; death under 'use re
Expand Down

0 comments on commit 174c990

Please sign in to comment.