diff options
author | pfg <pfg@FreeBSD.org> | 2014-05-01 01:42:48 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-05-01 01:42:48 +0000 |
commit | f0efccad2e3d203a71f4001b5574cf598f02ea56 (patch) | |
tree | 15483f74702a0c824228dd267fb28279afce0f6f /lib | |
parent | ab7478b3445f3a48428a698a9b5575c9e2ba9564 (diff) | |
download | FreeBSD-src-f0efccad2e3d203a71f4001b5574cf598f02ea56.zip FreeBSD-src-f0efccad2e3d203a71f4001b5574cf598f02ea56.tar.gz |
citrus: Avoid invalid code points.
From the OpenBSD log:
The UTF-8 decoder should not accept byte sequences which decode to unicode
code positions U+D800 to U+DFFF (UTF-16 surrogates), U+FFFE, and U+FFFF.
http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
http://unicode.org/faq/utf_bom.html#utf8-4
Reported by: Stefan Sperling
Obtained from: OpenBSD
MFC after: 5 days
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/locale/utf8.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c index ef5784a..cffa241 100644 --- a/lib/libc/locale/utf8.c +++ b/lib/libc/locale/utf8.c @@ -203,8 +203,7 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, errno = EILSEQ; return ((size_t)-1); } - if ((wch >= 0xd800 && wch <= 0xdfff) || - wch == 0xfffe || wch == 0xffff) { + if (wch >= 0xd800 && wch <= 0xdfff) { /* * Malformed input; invalid code points. */ |