Kaydet (Commit) 3cfea2dc authored tarafından Thomas Wouters's avatar Thomas Wouters

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.
üst 29b3d086
...@@ -3825,6 +3825,10 @@ datetime_strptime(PyObject *cls, PyObject *args) ...@@ -3825,6 +3825,10 @@ datetime_strptime(PyObject *cls, PyObject *args)
if (PySequence_Check(obj) && PySequence_Size(obj) >= 6) if (PySequence_Check(obj) && PySequence_Size(obj) >= 6)
for (i=0; i < 6; i++) { for (i=0; i < 6; i++) {
PyObject *p = PySequence_GetItem(obj, i); PyObject *p = PySequence_GetItem(obj, i);
if (p == NULL) {
Py_DECREF(obj);
return NULL;
}
if (PyInt_Check(p)) if (PyInt_Check(p))
ia[i] = PyInt_AsLong(p); ia[i] = PyInt_AsLong(p);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment