mirror of
https://github.com/python/cpython.git
synced 2026-04-01 01:21:04 +00:00
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
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue