diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-21 08:27:17 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-21 08:27:17 (GMT) |
commit | 1ac42614e3910232604fdb9de7b23ce0752bb635 (patch) | |
tree | 85d9842322910120c070421c5d78d2f89b0ef667 /Modules/timemodule.c | |
parent | 24a882bb7bc638644b9e66a082439416bfbcf66c (diff) | |
download | cpython-1ac42614e3910232604fdb9de7b23ce0752bb635.zip cpython-1ac42614e3910232604fdb9de7b23ce0752bb635.tar.gz cpython-1ac42614e3910232604fdb9de7b23ce0752bb635.tar.bz2 |
Issue #19748: On AIX, time.mktime() now raises an OverflowError for year
outsize range [1902; 2037].
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 44540ea..d0917a4 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -823,7 +823,18 @@ time_mktime(PyObject *self, PyObject *tup) time_t tt; if (!gettmarg(tup, &buf)) return NULL; +#ifdef _AIX + /* year < 1902 or year > 2037 */ + if (buf.tm_year < 2 || buf.tm_year > 137) { + /* Issue #19748: On AIX, mktime() doesn't report overflow error for + * timestamp < -2^31 or timestamp > 2**31-1. */ + PyErr_SetString(PyExc_OverflowError, + "mktime argument out of range"); + return NULL; + } +#else buf.tm_wday = -1; /* sentinel; original value ignored */ +#endif tt = mktime(&buf); /* Return value of -1 does not necessarily mean an error, but tm_wday * cannot remain set to -1 if mktime succeeded. */ |