This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte


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   `------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]