summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-08-25 20:14:50 +0000
committerbapt <bapt@FreeBSD.org>2015-08-25 20:14:50 +0000
commit2a77c3b71d27973d4ffac086902715be69266202 (patch)
tree420361e546af3d9b54e3a1573b672510b15062e4 /lib/libc/locale
parent795d1994935c72862e9c0f538c4f83b5b649ca96 (diff)
parent80b01acf73d4f8ff74678c4e7f57db989dba2366 (diff)
downloadFreeBSD-src-2a77c3b71d27973d4ffac086902715be69266202.zip
FreeBSD-src-2a77c3b71d27973d4ffac086902715be69266202.tar.gz
Merge from HEAD
Diffstat (limited to 'lib/libc/locale')
-rw-r--r--lib/libc/locale/utf8.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index 11e7825..e096b87 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -193,7 +193,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) {
+ if ((wch >= 0xd800 && wch <= 0xdfff) || wch > 0x10ffff) {
/*
* Malformed input; invalid code points.
*/
@@ -320,6 +320,10 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
lead = 0xc0;
len = 2;
} else if ((wc & ~0xffff) == 0) {
+ if (wc >= 0xd800 && wc <= 0xdfff) {
+ errno = EILSEQ;
+ return ((size_t)-1);
+ }
lead = 0xe0;
len = 3;
} else if (wc >= 0 && wc <= 0x10ffff) {
OpenPOWER on IntegriCloud