From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6507 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] implement a private state for the uchar.h functions Date: Sat, 15 Nov 2014 12:29:14 -0500 Message-ID: <20141115172914.GN22465@brightrain.aerifal.cx> References: <1415528228.2457.1188.camel@eris.loria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1416072577 19350 80.91.229.3 (15 Nov 2014 17:29:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 17:29:37 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6520-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 15 18:29:30 2014 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XphA9-0006wn-3i for gllmg-musl@m.gmane.org; Sat, 15 Nov 2014 18:29:29 +0100 Original-Received: (qmail 9768 invoked by uid 550); 15 Nov 2014 17:29:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9760 invoked from network); 15 Nov 2014 17:29:26 -0000 Content-Disposition: inline In-Reply-To: <1415528228.2457.1188.camel@eris.loria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:6507 Archived-At: 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