This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte
- To: Markus Kuhn <Markus dot Kuhn at cl dot cam dot ac dot uk>
- Subject: Re: BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte
- From: Ulrich Drepper <drepper at redhat dot com>
- Date: 10 Jan 2001 13:53:33 -0800
- Cc: bug-glibc at gnu dot org, libc-alpha at sourceware dot cygnus dot com
- References: <E14GS4H-0007AT-00@wisbech.cl.cam.ac.uk>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> writes:
> The following regression test fails in glibc 2.2 under linux-i386:
As Andreas said, this code doesn't fail anymore. But furthermore it's
incorrect:
> assert(mbrtowc(NULL, NULL, 0, &s) == 0); /* get s into initial state */
This is not how initializing a mbstate_t object can work. Since the
mbrtowc() function can read the mbstate_t object it will read
uninitialized memory. One has to use memset().
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------