summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-02 20:48:22 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-02 20:48:22 (GMT)
commite2dc0822941fd81e9db017f85a8475a26c00f952 (patch)
treee4cc5bd4078283d9a9fd2df4c416f57095dc1ee8 /Modules
parentece919eb0fd24bcb6fa095049a163ceb96316043 (diff)
downloadcpython-e2dc0822941fd81e9db017f85a8475a26c00f952.zip
cpython-e2dc0822941fd81e9db017f85a8475a26c00f952.tar.gz
cpython-e2dc0822941fd81e9db017f85a8475a26c00f952.tar.bz2
Issue #8013: Fixed time.asctime segfault when OS's asctime fails
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 89666a4..e8ea661 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -620,6 +620,10 @@ time_asctime(PyObject *self, PyObject *args)
} else if (!gettmarg(tup, &buf) || !checktm(&buf))
return NULL;
p = asctime(&buf);
+ if (p == NULL) {
+ PyErr_SetString(PyExc_ValueError, "invalid time");
+ return NULL;
+ }
if (p[24] == '\n')
p[24] = '\0';
return PyUnicode_FromString(p);