From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8523 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: out of range struct tm fields in strftime Date: Sun, 20 Sep 2015 18:44:35 +0200 Message-ID: <20150920164435.GB10551@port70.net> References: <20150920124450.GA10551@port70.net> <20150920163629.GL17773@brightrain.aerifal.cx> 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 1442767491 12255 80.91.229.3 (20 Sep 2015 16:44:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Sep 2015 16:44:51 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8535-gllmg-musl=m.gmane.org@lists.openwall.com Sun Sep 20 18:44:51 2015 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 1ZdhjO-0004Cz-1Z for gllmg-musl@m.gmane.org; Sun, 20 Sep 2015 18:44:50 +0200 Original-Received: (qmail 15452 invoked by uid 550); 20 Sep 2015 16:44:48 -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 15428 invoked from network); 20 Sep 2015 16:44:47 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20150920163629.GL17773@brightrain.aerifal.cx> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:8523 Archived-At: * Rich Felker [2015-09-20 12:36:29 -0400]: > On Sun, Sep 20, 2015 at 02:44:50PM +0200, Szabolcs Nagy wrote: > > out of range tm fields should not be treated as ub > > as noted in the thread > > http://sourceware.org/ml/libc-alpha/2015-09/msg00546.html > > > > i have a patch but there might be simpler approaches > > Wouldn't it be less invasive to just make some small changes like > putting a U on some of the constants so that the arithmetic happens as > unsigned? > that might be simpler (and probably generates better code for div,mod by const) but for the nl_langinfo item computation the range has to be limited properly (tm_wday and tm_mon are affected).