Remove 5 and 6 bytes sequences which are illegal in UTF-8 space. (part2)

Per rfc3629 value greater than 0x10ffff should be rejected

Suggested by:	jilles
This commit is contained in:
Baptiste Daroussin 2015-08-09 00:06:56 +00:00
parent c9d24bcfd5
commit 8bb93485fb

View File

@ -320,15 +320,9 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
} else if ((wc & ~0xffff) == 0) {
lead = 0xe0;
len = 3;
} else if ((wc & ~0x1fffff) == 0) {
} else if (wc >= 0 && wc <= 0x10ffff) {
lead = 0xf0;
len = 4;
} else if ((wc & ~0x3ffffff) == 0) {
lead = 0xf8;
len = 5;
} else if ((wc & ~0x7fffffff) == 0) {
lead = 0xfc;
len = 6;
} else {
errno = EILSEQ;
return ((size_t)-1);