Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Aug 2015 00:06:57 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r286491 - head/lib/libc/locale
Message-ID:  <201508090006.t7906vbK031238@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sun Aug  9 00:06:56 2015
New Revision: 286491
URL: https://svnweb.freebsd.org/changeset/base/286491

Log:
  Remove 5 and 6 bytes sequences which are illegal in UTF-8 space. (part2)
  
  Per rfc3629 value greater than 0x10ffff should be rejected
  
  Suggested by:	jilles

Modified:
  head/lib/libc/locale/utf8.c

Modified: head/lib/libc/locale/utf8.c
==============================================================================
--- head/lib/libc/locale/utf8.c	Sat Aug  8 23:59:15 2015	(r286490)
+++ head/lib/libc/locale/utf8.c	Sun Aug  9 00:06:56 2015	(r286491)
@@ -320,15 +320,9 @@ _UTF8_wcrtomb(char * __restrict s, wchar
 	} else if ((wc & ~0xffff) == 0) {
 		lead = 0xe0;
 		len = 3;
-	} else if ((wc & ~0x1fffff) == 0) {
+	} else if (wc >= 0 && wc <= 0x10ffff) {
 		lead = 0xf0;
 		len = 4;
-	} else if ((wc & ~0x3ffffff) == 0) {
-		lead = 0xf8;
-		len = 5;
-	} else if ((wc & ~0x7fffffff) == 0) {
-		lead = 0xfc;
-		len = 6;
 	} else {
 		errno = EILSEQ;
 		return ((size_t)-1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508090006.t7906vbK031238>