This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: bug in mbrtowc?
On Jul 28 10:56, Andy Koppe wrote:
> 2009/7/28 Pedro Izecksohn:
> > ?The bug is in O.P.'s code as &s is not being passed to mbrtowc.
>
> >From http://www.opengroup.org/onlinepubs/009695399/functions/mbrtowc.html:
> "If ps is a null pointer, the mbrtowc() function shall use its own
> internal mbstate_t object, which shall be initialized at program
> start-up to the initial conversion state."
>
> The test also fails when passing &s instead. (I'd accidentally left in
> the local mb_state.)
Yes, I checked that as well. It doesn't matter if the internal or
the `s' state is used. The problm is actually in __utf8_mbtowc.
It doesn't count a variable correctly which in turn results in reading
too much of the input if a the followup sequence of an incomplete
sequence is itself an incomplete sequence. My patch sent to the
newlib list (http://sourceware.org/ml/newlib/2009/msg00778.html)
fixes that.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple