|
|
Message-ID: <20140420031500.GV26358@brightrain.aerifal.cx>
Date: Sat, 19 Apr 2014 23:15:00 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Re: asctime(0) Segmentation fault
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
<time.h>, 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.