summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorTim Golden <mail@timgolden.me.uk>2013-11-12 12:48:20 (GMT)
committerTim Golden <mail@timgolden.me.uk>2013-11-12 12:48:20 (GMT)
commitbbe268f58334ec87940094f18dd2e13d1ef2ca70 (patch)
treedf1f0106b936677abb086dd69f7fb52c9000df77 /Modules/timemodule.c
parentdfcd69467489b940232adb5c82dd91aab4a25406 (diff)
parent6e51b8ff0f1a2210548b3ce18e6ba840e0a3c8ae (diff)
downloadcpython-bbe268f58334ec87940094f18dd2e13d1ef2ca70.zip
cpython-bbe268f58334ec87940094f18dd2e13d1ef2ca70.tar.gz
cpython-bbe268f58334ec87940094f18dd2e13d1ef2ca70.tar.bz2
Issue13674 Correct crash with strftime %y format under Windows
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 8d161d4..2e48007 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -642,6 +642,13 @@ time_strftime(PyObject *self, PyObject *args)
Py_DECREF(format);
return NULL;
}
+ if ((outbuf[1] == 'y') && buf.tm_year < 0)
+ {
+ PyErr_SetString(PyExc_ValueError,
+ "format %y requires year >= 1900 on Windows");
+ Py_DECREF(format);
+ return NULL;
+ }
}
#endif