- Treat the Unicode characters D800-DFFF and FFFE-FFFF as
invalid, since the C library's multibyte functions don't seem
to. (DLR)
+ make_mbchar()
+ - Treat the Unicode characters D800-DFFF and FFFE-FFFF as
+ invalid, since the C library's multibyte functions don't seem
+ to. (DLR)
parse_mbchar()
- Remove now-unneeded bad_chr parameter. (DLR)
mbstrchr()
chr_mb = charalloc(MB_CUR_MAX);
*chr_mb_len = wctomb(chr_mb, chr);
- if (*chr_mb_len < 0) {
+ /* Unicode D800-DFFF and FFFE-FFFF are invalid, even though
+ * they're parsed properly. */
+ if (*chr_mb_len < 0 || ((0xD800 <= chr && chr <= 0xDFFF) ||
+ (0XFFFE <= chr && chr <= 0xFFFF))) {
wctomb(NULL, 0);
*chr_mb_len = 0;
}