Date: Tue, 11 Aug 2015 18:34:02 +0200 From: Baptiste Daroussin <bapt@freebsd.org> To: Ed Schouten <ed@nuxi.nl> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers <src-committers@freebsd.org> Subject: Re: svn commit: r286491 - head/lib/libc/locale Message-ID: <20150811163314.GB10390@ivaldir.etoilebsd.net> In-Reply-To: <CABh_MKk7=WRYOF6KKEap_QenWJDGXDh=svv6DYcX0hVxP5XhoQ@mail.gmail.com> References: <201508090006.t7906vbK031238@repo.freebsd.org> <CABh_MKk7=WRYOF6KKEap_QenWJDGXDh=svv6DYcX0hVxP5XhoQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--W5WqUoFLvi1M7tJE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 11, 2015 at 06:28:06PM +0200, Ed Schouten wrote: > 2015-08-09 2:06 GMT+02:00 Baptiste Daroussin <bapt@freebsd.org>: > > Per rfc3629 value greater than 0x10ffff should be rejected >=20 > Not only that, values between 0xd800 and 0xdfff also need to be rejected: >=20 > 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 =3D 0xc0; > len =3D 2; > } else if ((wc & ~0xffff) =3D=3D 0) { > + if (wc >=3D 0xd800 && wc <=3D 0xdfff) { > + errno =3D EILSEQ; > + return ((size_t)-1); > + } > lead =3D 0xe0; > len =3D 3; > } else if (wc >=3D 0 && wc <=3D 0x10ffff) { Good catch please go ahead Bapt --W5WqUoFLvi1M7tJE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlXKI/kACgkQ8kTtMUmk6EwOhwCfdFSCi8nWDVRI59hxO4dASTUK 4kcAn3GEXDSOaRZ1Lte6EuAaPWGrz/MF =xnk5 -----END PGP SIGNATURE----- --W5WqUoFLvi1M7tJE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150811163314.GB10390>