Fix alnum parsing in glob conversion.

This commit is contained in:
Zoltán Herczeg 2017-05-28 04:05:58 +00:00
parent b317bdc184
commit 3f831482ab
3 changed files with 17 additions and 17 deletions

View File

@ -509,7 +509,7 @@ if (c != CHAR_COLON || pattern >= pattern_end ||
return 0; return 0;
class_ptr = posix_classes; class_ptr = posix_classes;
class_index = 0; class_index = 1;
while (TRUE) while (TRUE)
{ {
@ -554,19 +554,19 @@ convert_glob_char_in_class(int class_index, PCRE2_UCHAR c)
{ {
switch (class_index) switch (class_index)
{ {
case 0: return isalnum(c); case 1: return isalnum(c);
case 1: return isalpha(c); case 2: return isalpha(c);
case 2: return 1; case 3: return 1;
case 3: return c == CHAR_HT || c == CHAR_SPACE; case 4: return c == CHAR_HT || c == CHAR_SPACE;
case 4: return iscntrl(c); case 5: return iscntrl(c);
case 5: return isdigit(c); case 6: return isdigit(c);
case 6: return isgraph(c); case 7: return isgraph(c);
case 7: return islower(c); case 8: return islower(c);
case 8: return isprint(c); case 9: return isprint(c);
case 9: return ispunct(c); case 10: return ispunct(c);
case 10: return isspace(c); case 11: return isspace(c);
case 11: return isupper(c); case 12: return isupper(c);
case 12: return isalnum(c) || c == CHAR_UNDERSCORE; case 13: return isalnum(c) || c == CHAR_UNDERSCORE;
default: return isxdigit(c); default: return isxdigit(c);
} }
} }

View File

@ -225,7 +225,7 @@
/[^a\\b\c][!]][!-][^\]\-]/ /[^a\\b\c][!]][!-][^\]\-]/
/[[:alpha:][:xdigit:][:word:]]/ /[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]/
"[/-/]" "[/-/]"

View File

@ -357,8 +357,8 @@ No match
/[^a\\b\c][!]][!-][^\]\-]/ /[^a\\b\c][!]][!-][^\]\-]/
(?s)\A[^/a\\bc][^/\]][^/\-][^/\]\-]\z (?s)\A[^/a\\bc][^/\]][^/\-][^/\]\-]\z
/[[:alpha:][:xdigit:][:word:]]/ /[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]]/
(?s)\A[[:alpha:][:xdigit:][:word:]]\z (?s)\A[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:print:][:punct:][:space:][:upper:][:word:][:xdigit:]](?<!/)\z
"[/-/]" "[/-/]"
(?s)\A[/-/](?<!/)\z (?s)\A[/-/](?<!/)\z