Readd checking utf16 surrogates that are invalid in utf8

This commit is contained in:
Baptiste Daroussin 2015-08-09 10:36:25 +00:00
parent a6d2922cbb
commit 81eb7d7e4b

View file

@ -193,6 +193,13 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
errno = EILSEQ;
return ((size_t)-1);
}
if (wch >= 0xd800 && wch <= 0xdfff) {
/*
* Malformed input; invalid code points.
*/
errno = EILSEQ;
return ((size_t)-1);
}
if (pwc != NULL)
*pwc = wch;
us->want = 0;