[PATCH] _wctomb_r mishandles invalid wchars in single byte mode

Jeff Johnston jjohnstn@redhat.com
Tue Mar 3 00:33:00 GMT 2009


Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Corinna Vinschen on 2/27/2009 3:11 AM:
>   
>> Hi,
>>
>> right now the _wctomb_r function simply assumes that the incoming wchar
>> is a single byte value if the current multibyte charset is a singlebyte
>> charset.  This is wrong.  Per POSIX, wctomb "shall return -1 if the
>> value of wchar does not correspond to a valid character".  Per
>> POSIX.1-2008, wctomb should also set errno to EILSEQ.  The below patch
>> fixes that.
>>     
>
> wctomb.c needs the same fix when !_MB_CAPABLE.
>
>   
Done.  Thanks for noting this.
> - --
> Don't work too hard, make some time for fun as well!
>
> Eric Blake             ebb9@byu.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Cygwin)
> Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkmn7Y8ACgkQ84KuGfSFAYDAiQCdFtq6m6pTzlgOGExCbEFnXyZU
> O60Anjg9qdWgyWSNd+eI+cxTN55U4MVe
> =Np7W
> -----END PGP SIGNATURE-----
>   



More information about the Newlib mailing list