[Python-checkins] r45408 - python/trunk/Modules/datetimemodule.c
thomas.wouters
python-checkins at python.org
Fri Apr 14 23:23:43 CEST 2006
Author: thomas.wouters
Date: Fri Apr 14 23:23:42 2006
New Revision: 45408
Modified:
python/trunk/Modules/datetimemodule.c
Log:
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.
Modified: python/trunk/Modules/datetimemodule.c
==============================================================================
--- python/trunk/Modules/datetimemodule.c (original)
+++ python/trunk/Modules/datetimemodule.c Fri Apr 14 23:23:42 2006
@@ -3825,6 +3825,10 @@
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
More information about the Python-checkins
mailing list