Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 2015 18:27:01 +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: r286490 - head/lib/libc/locale
Message-ID:  <CABh_MKnnZ7g3kKs1n-xft4tH8m5vrPhDsvQR7CyyGYk_mUrvHw@mail.gmail.com>
In-Reply-To: <201508082359.t78NxGGZ026906@repo.freebsd.org>
References:  <201508082359.t78NxGGZ026906@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2015-08-09 1:59 GMT+02:00 Baptiste Daroussin <bapt@freebsd.org>:
>   Remove 5 and 6 bytes sequences which are illegal in UTF-8 space.
>
>   Per rfc3629 value greater than 0x10ffff should be rejected

I think the change you made only ensures that the value cannot exceed
0x1fffff -- not 0x10ffff. You probably need to do something like this:

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
@@ -191,7 +191,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.
  */

-- 
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_MKnnZ7g3kKs1n-xft4tH8m5vrPhDsvQR7CyyGYk_mUrvHw>