summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-03-24 10:38:59 -0600
committerSteve Hay <steve.m.hay@googlemail.com>2018-03-24 17:09:39 +0000
commitd7f1769e22923295a36dc62fed961aa272f7a4ca (patch)
tree50b20e1025d1ec869853a94e8bbfaf092067ae6c
parent70858a4fde4798f312b4c6d2cbae604a978aaf24 (diff)
downloadperl-d7f1769e22923295a36dc62fed961aa272f7a4ca.tar.gz
PATCH: [perl #132055] Assertion failure
This checks for and aborts if it find control characters in a supposed Unicode property name. Code further along could not handle these. This also fixes #132553 and #132658
-rw-r--r--regcomp.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index d79bd191c9..edfae9cffd 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -15925,6 +15925,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
case 'P':
{
char *e;
+ char *i;
+
/* We will handle any undefined properties ourselves */
U8 swash_init_flags = _CORE_SWASH_INIT_RETURN_IF_UNDEF
@@ -15968,6 +15970,14 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
n = e - RExC_parse;
while (isSPACE(*(RExC_parse + n - 1)))
n--;
+
+ for (i = RExC_parse; i < RExC_parse + n; i++) {
+ if (isCNTRL(*i) && *i != '\t') {
+ char * name = Perl_form(aTHX_ "%.*s", (int)n, RExC_parse);
+ RExC_parse = e + 1;
+ vFAIL2("Can't find Unicode property definition \"%s\"", name);
+ }
+ }
} /* The \p isn't immediately followed by a '{' */
else if (! isALPHA(*RExC_parse)) {
RExC_parse += (UTF) ? UTF8SKIP(RExC_parse) : 1;