1
0
Fork 0

(svn r21260) -Codechange: make strgen more stringent w.r.t. the allowed characters in strings

release/1.1
rubidium 2010-11-19 19:38:02 +00:00
parent 8ba6d25db6
commit ede2fb8176
1 changed files with 9 additions and 0 deletions

View File

@ -709,6 +709,15 @@ static void HandleString(char *str, bool master)
for (tmp = s; *tmp != '\0';) {
size_t len = Utf8Validate(tmp);
if (len == 0) error("Invalid UTF-8 sequence in '%s'", s);
WChar c;
Utf8Decode(&c, tmp);
if (c <= 0x001F || // ASCII control character range
(c >= 0xE000 && c <= 0xF8FF) || // Private range
(c >= 0xFFF0 && c <= 0xFFFF)) { // Specials range
error("Unwanted UTF-8 character U+%04X in sequence '%s'", c, s);
}
tmp += len;
}