diff options
Diffstat (limited to 'Modules')
-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. */ |