Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 2015 18:28:06 +0200
From:      Ed Schouten <ed@nuxi.nl>
To:        Baptiste Daroussin <bapt@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r286491 - head/lib/libc/locale
Message-ID:  <CABh_MKk7=WRYOF6KKEap_QenWJDGXDh=svv6DYcX0hVxP5XhoQ@mail.gmail.com>
In-Reply-To: <201508090006.t7906vbK031238@repo.freebsd.org>
References:  <201508090006.t7906vbK031238@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2015-08-09 2:06 GMT+02:00 Baptiste Daroussin <bapt@freebsd.org>:
>   Per rfc3629 value greater than 0x10ffff should be rejected

Not only that, values between 0xd800 and 0xdfff also need to be rejected:

diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index 55e2931..8ccfdb1 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -318,6 +318,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) {

-- 
Ed Schouten <ed@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MKk7=WRYOF6KKEap_QenWJDGXDh=svv6DYcX0hVxP5XhoQ>