From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Re: asctime(0) Segmentation fault
Date: Sat, 19 Apr 2014 23:15:00 -0400 [thread overview]
Message-ID: <20140420031500.GV26358@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAGDMk9GeX5YZqBay4HnfNiepP5QzSfTUrrE-fkpv0RUuyC_7_g@mail.gmail.com>
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
next prev parent reply other threads:[~2014-04-20 3:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-19 22:16 John Mudd
2014-04-19 22:36 ` Jens Gustedt
2014-04-19 22:46 ` John Mudd
2014-04-20 1:43 ` Szabolcs Nagy
2014-04-20 1:59 ` Rich Felker
2014-04-20 2:43 ` John Mudd
2014-04-20 2:51 ` John Mudd
2014-04-20 3:15 ` Rich Felker [this message]
2014-04-20 3:33 ` John Mudd
2014-04-20 3:35 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140420031500.GV26358@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).