Date: Thu, 21 Apr 2016 09:43:13 +0200 From: Baptiste Daroussin <bapt@FreeBSD.org> To: Andrey Chernov <ache@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r298367 - head/lib/libc/locale Message-ID: <20160421074313.GJ26116@ivaldir.etoilebsd.net> In-Reply-To: <7ef69cc0-4f38-788d-3fab-5058749cee8e@freebsd.org> References: <201604202044.u3KKiUMq081452@repo.freebsd.org> <a2485516-9b18-6323-934d-45ed915b52ff@freebsd.org> <b8387257-5354-6a66-332b-7d07f1bdb25c@freebsd.org> <20160421062953.GI26116@ivaldir.etoilebsd.net> <7ef69cc0-4f38-788d-3fab-5058749cee8e@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--P6YfpwaDcfcOCJkJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 21, 2016 at 10:22:48AM +0300, Andrey Chernov wrote: > On 21.04.2016 9:29, Baptiste Daroussin wrote: > >>>> Modified: head/lib/libc/locale/ascii.c > >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > >>>> --- head/lib/libc/locale/ascii.c Wed Apr 20 20:43:05 2016 (r298366) > >>>> +++ head/lib/libc/locale/ascii.c Wed Apr 20 20:44:30 2016 (r298367) > >>>> @@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d > >>>> =20 > >>>> if (dst =3D=3D NULL) { > >>>> s =3D memchr(*src, '\0', nms); > >>>> + if (s =3D=3D NULL) > >>>> + return (nms); > >>>> + > >>>> if (*s & 0x80) { > >>>> errno =3D EILSEQ; > >>>> return ((size_t)-1); > >>>> } > >>>> - return (s !=3D NULL ? s - *src : nms); > >>>> + return (s - *src); > >>>> } > >>>> =20 > >>>> s =3D *src; > >>>> > >>> > >>> The whole code is incorrect, only the very first char is checked, the= re > >>> must be a loop like in -stable: > >>> > >>> if (dst =3D=3D NULL) { > >>> for (s =3D *src; nms > 0 && *s !=3D '\0'; s++, nms--)= { > >>> if (*s & 0x80) { > >>> errno =3D EILSEQ; > >>> return ((size_t)-1); > >>> } > >>> } > >>> return (s - *src); > >>> } > >>> > >>> Since svn history is lost on deleting, I don't know why incorrect > >>> version was committed. > >>> > >> > >> Typo, the very first =3D=3D the very last, i.e. only NUL char is check= ed > >> which always pass. > >> > >=20 > > I have restored the history (I hope correctly) > >=20 > > Bapt > >=20 >=20 I backed it out to the original version, I really sorry for all the mess I = made there. Bapt --P6YfpwaDcfcOCJkJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXGISRAAoJEGOJi9zxtz5aNrIQALfP2xXapdyu/Tm9ROGoSKiN RGTpRh38J8BLYi4/hqFbIoj0uUbFgKW3uJK+aKAxYFODU3KsMFnb8DAuPHEUc6jY bjWvVMNlvfd9bccDL6KhZEWSUa1IitZfrDKRIRXakN3EeQ6mPDYKBHJK9U1l5aF9 j+IPyZwMX/n18FLFF8u8fBgpVZWkHrujR4VgO4v0jxUXkx14VCM7q4FUHrqXWhqN ZGx4bSsUfJvzbX+ozYoLa5l1dt/v/CnIZNagsnTpOa1XJ6iK7E9o0XIjGJmWL99P 2ghoKnXAhAAR4tlgPgcV6fXCljBEXWFeQE8UVESNg9/AlZtIuZQAqfC/BvJxpe0U drGSAdo16Q0D9pqsNyERrsS37vWWnNLcTgGGg6OGC8D2dYz9rWqetvTvKeWdBBAZ RLhB1hwWBbnWJWw1RNOvIRCDWpNKQYxr+kkzXyggB65jS9hcZNW4Bmax0zooFX4W ITQrtp0LdCCfQwz0Qbo7XXk9OWbpTj/QHU6xQ0ojGSUrkiIULFhm4dXtDRM5dOTM /JiStD3ITaQ6j2bLEUQx43lZozUS3/bggqCynW6MMjlF5miekgHrvWtGNs1NvwgQ Rc6SQpBoWcm3cv8yi66P+plFLg+qtqRxY9ozxKrHvBTT73T1z9nGIuLL/l7bvEad QaTnpyYVqhr/3tx6/P1h =cZxm -----END PGP SIGNATURE----- --P6YfpwaDcfcOCJkJ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160421074313.GJ26116>