This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #134029] Fail assert in pattern wildcard
authorKarl Williamson <khw@cpan.org>
Mon, 15 Apr 2019 18:05:07 +0000 (12:05 -0600)
committerKarl Williamson <khw@cpan.org>
Mon, 15 Apr 2019 18:09:11 +0000 (12:09 -0600)
The failing pattern has a single character subpattern, which should be
caught and compilation aborted, and this commit now does so.

regcomp.c
t/re/pat_advanced.t

index 7bbfec0..2939502 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -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");
index 1808d35..290dc24 100644 (file)
@@ -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