summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/utf8.c')
-rw-r--r--lib/libc/locale/utf8.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index 40f0e17..cffa241 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -203,6 +203,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;
OpenPOWER on IntegriCloud