Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141115172914.GN22465@brightrain.aerifal.cx>
Date: Sat, 15 Nov 2014 12:29:14 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] implement a private state for the uchar.h
 functions

On Sun, Nov 09, 2014 at 11:18:08AM +0100, Jens Gustedt wrote:
> The C standard is imperative on that:
> 
>   7.28.1 ... If ps is a null pointer, each function uses its own internal
>   mbstate_t object instead, which is initialized at program startup to
>   the initial conversion state;
> 
> and these functions are also not supposed to implicitly use the state of
> the wchar.h functions:
> 
>   7.29.6.3 ... The implementation behaves as if no library function calls
>   these functions with a null pointer for ps.
> 
> Previously this resulted in two bugs.
> 
>  - The functions c16rtomb and mbrtoc16 would crash when called with ps
>    set to null.
> 
>  - The functions c32rtomb and mbrtoc32 used the private states of wcrtomb
>    and mbrtowc, respectively, which they are not allowed to do.

One small correction: wcrtomb has no state, and c32rtomb does not need
any either.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.