diff options
author | Thomas Wouters <thomas@python.org> | 2006-04-14 21:23:42 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-04-14 21:23:42 (GMT) |
commit | 3cfea2dc987b90e637c4cbd5db5dc1f542e448b2 (patch) | |
tree | 1afafe19f6d0cfb216531b26ebdd5e3128a89fd1 /Modules/datetimemodule.c | |
parent | 29b3d08604ba396861509bb1feb7ac6ec5456ae2 (diff) | |
download | cpython-3cfea2dc987b90e637c4cbd5db5dc1f542e448b2.zip cpython-3cfea2dc987b90e637c4cbd5db5dc1f542e448b2.tar.gz cpython-3cfea2dc987b90e637c4cbd5db5dc1f542e448b2.tar.bz2 |
Coverity-found bug: datetime_strptime() failed to check for NULL return from
PySequence_GetItem of the time.strptime() result. Not a high probability
bug, but not inconceivable either, considering people can provide their own
'time' module.
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r-- | Modules/datetimemodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 6823110..a8fa4e7 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -3825,6 +3825,10 @@ datetime_strptime(PyObject *cls, PyObject *args) if (PySequence_Check(obj) && PySequence_Size(obj) >= 6) for (i=0; i < 6; i++) { PyObject *p = PySequence_GetItem(obj, i); + if (p == NULL) { + Py_DECREF(obj); + return NULL; + } if (PyInt_Check(p)) ia[i] = PyInt_AsLong(p); else |