Skip to content

Commit

Permalink
PATCH: [perl #134029] Fail assert in pattern wildcard
Browse files Browse the repository at this point in the history
The failing pattern has a single character subpattern, which should be
caught and compilation aborted, and this commit now does so.
  • Loading branch information
khwilliamson committed Apr 15, 2019
1 parent 2cf7500 commit 11b48e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion regcomp.c
Expand Up @@ -22728,7 +22728,8 @@ Perl_parse_uniprop_string(pTHX_
pos_in_brackets = strchr("([<)]>)]>", open);
close = (pos_in_brackets) ? pos_in_brackets[3] : open;

if ( name[name_len-1] != close
if ( i >= name_len
|| name[name_len-1] != close
|| (escaped && name[name_len-2] != '\\'))
{
sv_catpvs(msg, "Unicode property wildcard not terminated");
Expand Down
7 changes: 7 additions & 0 deletions t/re/pat_advanced.t
Expand Up @@ -2512,6 +2512,13 @@ EOF
"Assertion failure with *COMMIT and wildcard property");
}

{ # [perl #134029] Previously assertion failure
fresh_perl_like('qr/\p{upper:]}|\337(?|ss)|)(?0/',
qr/Unicode property wildcard not terminated/,
{},
"Assertion failure with single character wildcard");
}


# !!! NOTE that tests that aren't at all likely to crash perl should go
# a ways above, above these last ones. There's a comment there that, like
Expand Down

0 comments on commit 11b48e7

Please sign in to comment.