From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5657 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Non-stub gettext API functions committed, ready for testing Date: Sun, 27 Jul 2014 14:00:41 -0400 Message-ID: <20140727180041.GA4038@brightrain.aerifal.cx> References: <20140727084633.GA22355@brightrain.aerifal.cx> <53D4CF09.1050209@gmx.de> <20140727141417.GG10402@port70.net> <20140727164921.GY4038@brightrain.aerifal.cx> <20140727172308.GH10402@port70.net> <20140727173605.GZ4038@brightrain.aerifal.cx> <20140727175125.GI10402@port70.net> 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 1406484064 9667 80.91.229.3 (27 Jul 2014 18:01:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Jul 2014 18:01:04 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5662-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 27 20:00:57 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XBSkg-0005S4-Db for gllmg-musl@plane.gmane.org; Sun, 27 Jul 2014 20:00:54 +0200 Original-Received: (qmail 1676 invoked by uid 550); 27 Jul 2014 18:00:53 -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 1668 invoked from network); 27 Jul 2014 18:00:53 -0000 Content-Disposition: inline In-Reply-To: <20140727175125.GI10402@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:5657 Archived-At: On Sun, Jul 27, 2014 at 07:51:26PM +0200, Szabolcs Nagy wrote: > > >From what I can tell, that's not so bad. Anyone feel like writing an > > expression evaluator for it? I think recursive descent is fine as long > > as the length of the string being evaluated is capped at a sane length > > (or just keep a depth counter and abort the evaluation if it exceeds > > some reasonable limit). > > > > i can try OK. Some thoughts on implementation: It should probably accept the expression as a base+length rather than a C string so it can be used in-place from within the mo file "header" (this design might help for recursion anyway I suppose). And it should be safe against malicious changes to the expression during evaluation (at worst give wrong results or error out rather than risk of stack overflow, out-of-bounds reads, etc.) since I'm aiming to make the whole system safe against malicious translation files (assuming the caller doesn't use the results in unsafe ways like as a format string). Rich