STINNER Victor added the comment:

Oh, I forgot to describe the bug.

asctime() (and ctime()?) do crash on year > 9999 with musl. musl uses an 
hardcoded buffer of 26 bytes:
http://git.musl-libc.org/cgit/musl/tree/src/time/__asctime.c

musl developers consider that the caller must reject year larger than 9999:


                /* ISO C requires us to use the above format string,
                 * even if it will not fit in the buffer. Thus asctime_r
                 * is _supposed_ to crash if the fields in tm are too large.
                 * We follow this behavior and crash "gracefully" to warn
                 * application developers that they may not be so lucky
                 * on other implementations (e.g. stack smashing..).
                 */
                a_crash();


I disagree. asctime() must either return a longer string, or return an error. 
But not crash.

----------
title: [2.7] time.asctime() buffer overflow for year > 9999 using mucl (C 
library) -> [2.7] time.asctime() crash with year > 9999 using musl C library

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31339>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to