Commit b3bda4fd authored by Kim F. Storm's avatar Kim F. Storm

(skip_chars): Only recognize [:class:] when it has the

proper format and class is a lower-case word.
parent cdc97764
...@@ -1455,7 +1455,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes) ...@@ -1455,7 +1455,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
{ {
const unsigned char *class_beg = str + i_byte + 1; const unsigned char *class_beg = str + i_byte + 1;
const unsigned char *class_end = class_beg; const unsigned char *class_end = class_beg;
const unsigned char *class_limit = str + size_byte; const unsigned char *class_limit = str + size_byte - 2;
/* Leave room for the null. */ /* Leave room for the null. */
unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
re_wctype_t cc; re_wctype_t cc;
...@@ -1463,17 +1463,13 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes) ...@@ -1463,17 +1463,13 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH) if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH)
class_limit = class_beg + CHAR_CLASS_MAX_LENGTH; class_limit = class_beg + CHAR_CLASS_MAX_LENGTH;
while (class_end != class_limit while (class_end < class_limit
&& ! (*class_end >= 0200 && *class_end >= 'a' && *class_end <= 'z')
|| *class_end <= 040
|| (*class_end == ':'
&& class_end[1] == ']')))
class_end++; class_end++;
if (class_end == class_limit if (class_end == class_beg
|| *class_end >= 0200 || *class_end != ':' || class_end[1] != ']')
|| *class_end <= 040) goto not_a_class_name;
error ("Invalid ISO C character class");
bcopy (class_beg, class_name, class_end - class_beg); bcopy (class_beg, class_name, class_end - class_beg);
class_name[class_end - class_beg] = 0; class_name[class_end - class_beg] = 0;
...@@ -1488,6 +1484,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes) ...@@ -1488,6 +1484,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
continue; continue;
} }
not_a_class_name:
if (c == '\\') if (c == '\\')
{ {
if (i_byte == size_byte) if (i_byte == size_byte)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment