From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4925 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: asctime(0) Segmentation fault Date: Sat, 19 Apr 2014 23:15:00 -0400 Message-ID: <20140420031500.GV26358@brightrain.aerifal.cx> References: 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 1397963725 10582 80.91.229.3 (20 Apr 2014 03:15:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Apr 2014 03:15:25 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4929-gllmg-musl=m.gmane.org@lists.openwall.com Sun Apr 20 05:15:17 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 1WbiDp-0005Ao-Jx for gllmg-musl@plane.gmane.org; Sun, 20 Apr 2014 05:15:13 +0200 Original-Received: (qmail 22303 invoked by uid 550); 20 Apr 2014 03:15:12 -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 22295 invoked from network); 20 Apr 2014 03:15:12 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:4925 Archived-At: On Sat, Apr 19, 2014 at 10:51:34PM -0400, John Mudd wrote: > That was incomplete. > > >From Python-2.7.6/Lib/test/test_time.py: > > def test_asctime(self): > time.asctime(time.gmtime(self.t)) > self.assertRaises(TypeError, time.asctime, 0) > self.assertRaises(TypeError, time.asctime, ()) > # XXX: Posix compiant asctime should refuse to convert > # year > 9999, but Linux implementation does not. This is false. POSIX explicitly says the behavior is undefined: However, the behavior is undefined if timeptr->tm_wday or timeptr->tm_mon are not within the normal ranges as defined in , or if timeptr->tm_year exceeds {INT_MAX}-1990, or if the above algorithm would attempt to generate more than 26 bytes of output (including the terminating null). (http://pubs.opengroup.org/onlinepubs/9699919799/functions/asctime.html) This agrees with ISO C. Thus the test Python is performing is invalid. However I'm unclear on how it involves a null pointer being passed to asctime. Are you sure this is actually the offending test? Rich