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.
This commit is contained in:
Thomas Wouters 2006-04-14 21:23:42 +00:00
parent 29b3d08604
commit 3cfea2dc98
1 changed files with 4 additions and 0 deletions

View File

@ -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