Fix overrun bug in recent property name parsing change

This commit is contained in:
Philip Hazel 2022-01-14 12:24:23 +00:00
parent 360a84e80b
commit 504ff06fff
4 changed files with 19 additions and 2 deletions

View File

@ -62,6 +62,10 @@ including Bidi_Control.
(d) The standard Unicode 4-letter abbreviations for script names are now
recognized.
(e) In accordance with Unicode and Perl's "loose matching" rules, spaces,
hyphens, and underscores are ignored in property names, which are then
matched independent of case.
18. The Python scripts in the maint directory have been refactored. There are
now three scripts that generate pcre2_ucd.c, pcre2_ucp.h, and pcre2_ucptables.c
(which is #included by pcre2_tables.c). The data lists that used to be

View File

@ -2115,7 +2115,11 @@ if (c == CHAR_LEFT_CURLY_BRACKET)
{
if (ptr >= cb->end_pattern) goto ERROR_RETURN;
c = *ptr++;
while (c == '_' || c == '-' || isspace(c)) c = *ptr++;
while (c == '_' || c == '-' || isspace(c))
{
if (ptr >= cb->end_pattern) goto ERROR_RETURN;
c = *ptr++;
}
if (c == CHAR_NUL) goto ERROR_RETURN;
if (c == CHAR_RIGHT_CURLY_BRACKET) break;
name[i] = tolower(c);

4
testdata/testinput5 vendored
View File

@ -2208,4 +2208,8 @@
/\p{soft dotted}\p{sd}/g,utf
>AF23<>\x{1df1a}\x{69}<>yz<
# ------------------------------------------------
/\p{\2b[:x臺gi:t:_/
# End of testinput5

View File

@ -5011,4 +5011,9 @@ Failed: error 147 at offset 8: unknown property after \P or \p
>AF23<>\x{1df1a}\x{69}<>yz<
0: \x{1df1a}i
# ------------------------------------------------
/\p{\2b[:xäigi:t:_/
Failed: error 146 at offset 17: malformed \P or \p sequence
# End of testinput5