From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10978 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: a bug in bindtextdomain() and strip '.UTF-8' Date: Sun, 29 Jan 2017 09:07:47 -0500 Message-ID: <20170129140747.GJ1533@brightrain.aerifal.cx> References: <20170129133946.GT17692@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1485698886 27862 195.159.176.226 (29 Jan 2017 14:08:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 14:08:06 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-10993-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jan 29 15:08:02 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cXq96-0006NW-K2 for gllmg-musl@m.gmane.org; Sun, 29 Jan 2017 15:07:56 +0100 Original-Received: (qmail 17562 invoked by uid 550); 29 Jan 2017 14:08:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 17532 invoked from network); 29 Jan 2017 14:07:59 -0000 Content-Disposition: inline In-Reply-To: <20170129133946.GT17692@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10978 Archived-At: On Sun, Jan 29, 2017 at 02:39:47PM +0100, Szabolcs Nagy wrote: > * He X [2017-01-29 12:52:56 +0800]: > > 1. no memset after malloc, caused chromium crash: > > http://www.openwall.com/lists/musl/2017/01/28/1 > > --- musl-1.1.16/src/locale/dcngettext.c 2017-01-29 04:42:49.002221317 +0000 > > +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-29 04:42:49.002221317 +0000 > > @@ -180,6 +180,7 @@ > > __munmap((void *)map, map_size); > > goto notrans; > > } > > + memset(p, 0, sizeof *p + namelen + 1); > > p->map = map; > > p->map_size = map_size; > > memcpy(p->name, name, namelen+1); > > if you want to zero the entire allocation, then use calloc. > but i think initializing plural_rule is enough. Conceptually it seems nice to avoid filling name[] twice, but since namelen is bounded in size (note: we should be using strnlen elsewhere where it first gets introduced, but strlen is already checked) it's not such a practical issue. I would be ok with just zeroing plural_rule and nplurals (the latter doesn't seem necessary but leaving it uninitialized until later seems to be a poor choice w.r.t. future-proofing the code) but just calling calloc for these allocations is probably the cleanest fix. > > 2. musl uses generic config of libstdc++, which blocked the support of > > locale, patch is there: > > https://github.com/xhebox/noname-linux/issues/2#issuecomment-275704150 > > this breaks the abi of libstdc++ because the definition of > a type in the public api is changed. > > so existing c++ binaries break if the toolchain is patched. I'm not sufficiently familiar with this code to understand why right away. Do you see an easy fix to avoid ABI breakage while fixing the bug? Rich