[Python-checkins] python/dist/src/Python bltinmodule.c, 2.292,
2.292.10.1
doerwalter at users.sourceforge.net
doerwalter at users.sourceforge.net
Mon Aug 18 12:34:13 EDT 2003
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv17833/Python
Modified Files:
Tag: release23-maint
bltinmodule.c
Log Message:
Backport checkin:
Fix a crash: when sq_item failed the code continued blindly and used the
NULL pointer. (Detected by Michael Hudson, patch provided by Neal Norwitz).
Fix refcounting leak in filtertuple().
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.292
retrieving revision 2.292.10.1
diff -C2 -d -r2.292 -r2.292.10.1
*** bltinmodule.c 23 Apr 2003 13:34:35 -0000 2.292
--- bltinmodule.c 18 Aug 2003 18:34:09 -0000 2.292.10.1
***************
*** 2177,2180 ****
--- 2177,2182 ----
tuple->ob_type->tp_as_sequence->sq_item) {
item = tuple->ob_type->tp_as_sequence->sq_item(tuple, i);
+ if (item == NULL)
+ goto Fail_1;
} else {
PyErr_SetString(PyExc_TypeError, "filter(): unsubscriptable tuple");
***************
*** 2187,2204 ****
else {
PyObject *arg = Py_BuildValue("(O)", item);
! if (arg == NULL)
goto Fail_1;
good = PyEval_CallObject(func, arg);
Py_DECREF(arg);
! if (good == NULL)
goto Fail_1;
}
ok = PyObject_IsTrue(good);
Py_DECREF(good);
if (ok) {
- Py_INCREF(item);
if (PyTuple_SetItem(result, j++, item) < 0)
goto Fail_1;
}
}
--- 2189,2211 ----
else {
PyObject *arg = Py_BuildValue("(O)", item);
! if (arg == NULL) {
! Py_DECREF(item);
goto Fail_1;
+ }
good = PyEval_CallObject(func, arg);
Py_DECREF(arg);
! if (good == NULL) {
! Py_DECREF(item);
goto Fail_1;
+ }
}
ok = PyObject_IsTrue(good);
Py_DECREF(good);
if (ok) {
if (PyTuple_SetItem(result, j++, item) < 0)
goto Fail_1;
}
+ else
+ Py_DECREF(item);
}
More information about the Python-checkins
mailing list