[issue11327] Running test_time.py in python27 caused python to unexpectedly quit
Charles-Francois Natali
report at bugs.python.org
Sat Feb 26 11:02:16 CET 2011
Charles-Francois Natali <neologix at free.fr> added the comment:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Python crashes when dereferencing 0x0000000000000018, which is NULL + 24
This means that it crashes here:
p = asctime(&buf);
if (p[24] == '\n')
p[24] = '\0';
No check is made on asctime(3) return's value, so if it returns NULL, we'll segfault.
I think the problem is that gettmarg doesn't check its returned struct tm.
Also, in time_strtime, there's this comment:
Checks added to make sure strftime() does not crash Python by
414 indexing blindly into some array for a textual representation
415 by some bad index (fixes bug #897625).
416
Is there any good reason why those checks aren't performed directly in
gettmarg ?
----------
nosy: +neologix
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11327>
_______________________________________
More information about the Python-bugs-list
mailing list