[issue8013] time.asctime segfaults when given a time in the far future
Alexander Belopolsky
report at bugs.python.org
Sun Jan 2 23:53:48 CET 2011
Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:
On Sun, Jan 2, 2011 at 5:35 PM, Georg Brandl <report at bugs.python.org> wrote:
..
> Both asctime() and ctime() fixed to remove newline no matter how many
> digits the year has in r87657. I also took the liberty of making the error
> messages consistent.
Georg,
I disagree with your solution. According to relevant standards,
asctime is undefined for year > 9999. A compliant implementation can
do anything in this case including not null-terminating the internal
buffer. With your change, time.strftime will happily replace the
first unrelated '\n' with '\0' that it will find beyond the internal
buffer.
I was considering raising an ValueError if '\n' is not found at 24th
position, but this (or a precondition check solution) should wait
until 3.3.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8013>
_______________________________________
More information about the Python-bugs-list
mailing list