Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Aug 2015 10:36:25 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r286518 - projects/collation/lib/libc/locale
Message-ID:  <201508091036.t79AaPvc066034@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sun Aug  9 10:36:25 2015
New Revision: 286518
URL: https://svnweb.freebsd.org/changeset/base/286518

Log:
  Readd checking utf16 surrogates that are invalid in utf8

Modified:
  projects/collation/lib/libc/locale/utf8.c

Modified: projects/collation/lib/libc/locale/utf8.c
==============================================================================
--- projects/collation/lib/libc/locale/utf8.c	Sun Aug  9 10:24:24 2015	(r286517)
+++ projects/collation/lib/libc/locale/utf8.c	Sun Aug  9 10:36:25 2015	(r286518)
@@ -193,6 +193,13 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
 		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;



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