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:
parent
29b3d08604
commit
3cfea2dc98
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue