diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-05-22 22:08:34 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-05-22 22:08:34 (GMT) |
commit | d9ef74e3ddffc9327a3b225734cdc5a5028e8d0b (patch) | |
tree | 202707d6b6862764cfc7444c85bf10cbc70c7d80 /Modules/timemodule.c | |
parent | 945fff44c496c3d918d42b148087faf73008c85d (diff) | |
download | cpython-d9ef74e3ddffc9327a3b225734cdc5a5028e8d0b.zip cpython-d9ef74e3ddffc9327a3b225734cdc5a5028e8d0b.tar.gz cpython-d9ef74e3ddffc9327a3b225734cdc5a5028e8d0b.tar.bz2 |
Issue 24244: Prevents termination when an invalid format string is encountered on Windows.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 5f6290d..197d2c0 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -616,13 +616,6 @@ time_strftime(PyObject *self, PyObject *args) { if (outbuf[1]=='#') ++outbuf; /* not documented by python, */ - if (outbuf[1]=='\0' || - !strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1])) - { - PyErr_SetString(PyExc_ValueError, "Invalid format string"); - Py_DECREF(format); - return NULL; - } if ((outbuf[1] == 'y') && buf.tm_year < 0) { PyErr_SetString(PyExc_ValueError, @@ -660,7 +653,9 @@ time_strftime(PyObject *self, PyObject *args) PyErr_NoMemory(); break; } + _Py_BEGIN_SUPPRESS_IPH buflen = format_time(outbuf, i, fmt, &buf); + _Py_END_SUPPRESS_IPH #if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) err = errno; #endif |