[Yum] anyone can comment this?
Jeff Johnson
jbj at redhat.com
Sun Jul 28 14:31:17 UTC 2002
On Sun, Jul 28, 2002 at 10:04:02AM -0400, Jeff Johnson wrote:
>
> Here's a guess:
> There's an obscure data driven off-by-1 bug that caused added
> packages to walf off the end of an array.
Nope, here's a pathc for the bindings (4.1, but the code in 4.0.4
bindings is very similarly broken).
Another way out would be to add with 'i', not 'u', as the segfault
is/was coming from an erased package dragged in from the database,
and erased packages don't have not steenkin' python objects attached.
Index: rpmts-py.c
===================================================================
RCS file: /cvs/devel/rpm/python/rpmts-py.c,v
retrieving revision 1.11
diff -u -r1.11 rpmts-py.c
--- rpmts-py.c 25 Jul 2002 17:03:15 -0000 1.11
+++ rpmts-py.c 28 Jul 2002 14:23:59 -0000
@@ -530,7 +530,8 @@
if (!PyArg_ParseTuple(args, ":GetKeys")) return NULL;
rpmtsGetKeys(s->ts, &data, &num);
- if (data == NULL) {
+ if (data == NULL || num <= 0) {
+ data = _free(data);
Py_INCREF(Py_None);
return Py_None;
}
@@ -538,12 +539,13 @@
tuple = PyTuple_New(num);
for (i = 0; i < num; i++) {
- PyObject *obj = (PyObject *) data[i];
+ PyObject *obj;
+ obj = (data[i] ? (PyObject *) data[i] : Py_None);
Py_INCREF(obj);
PyTuple_SetItem(tuple, i, obj);
}
- free (data);
+ data = _free(data);
return tuple;
}
73 de Jeff
--
Jeff Johnson ARS N3NPQ
jbj at redhat.com (jbj at jbj.org)
Chapel Hill, NC
More information about the Yum
mailing list