BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte
Ulrich Drepper
drepper@redhat.com
Wed Jan 10 13:53:00 GMT 2001
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 `------------------------
More information about the Libc-alpha
mailing list