summaryrefslogtreecommitdiffstats
path: root/Python/pytime.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pytime.c')
-rw-r--r--Python/pytime.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/pytime.c b/Python/pytime.c
index 0e94131..68c49a8 100644
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -1062,6 +1062,20 @@ _PyTime_localtime(time_t t, struct tm *tm)
}
return 0;
#else /* !MS_WINDOWS */
+#ifdef _AIX
+ /* AIX does not return NULL on an error
+ so test ranges - asif!
+ (1902-01-01, -2145916800.0)
+ (2038-01-01, 2145916800.0) */
+ if (abs(t) > (time_t) 2145916800) {
+#ifdef EINVAL
+ errno = EINVAL;
+#endif
+ PyErr_SetString(PyExc_OverflowError,
+ "ctime argument out of range");
+ return -1;
+ }
+#endif
if (localtime_r(&t, tm) == NULL) {
#ifdef EINVAL
if (errno == 0) {