[XML-SIG] Bug in exception handling?

Jack Jansen jack@oratrix.nl
Thu, 08 Jul 1999 10:49:40 +0200

> Sounds like a hack to me. Shouldn't it be solved by INCREF'ing the buffer
> somewhere in the C code to pyexpat? e.g. where the exception code makes
> reference to the buffer? I didn't look at the code myself, so I don't
> know whether it is particularly difficult to find.

I looked, but I can't see anything. I haven't a clue how this code code be 
responsible for an extra free:

static PyObject *
xmlparse_Parse(self, args)
	xmlparseobject *self;
	PyObject *args;
	char *s;
	int slen;
	int isFinal = 0;
	int rv;
	if (!PyArg_ParseTuple(args, "s#|i", &s, &slen, &isFinal))
		return NULL;
	if (setjmp(self->jmpbuf)) {
		/* Error in callback routine */
		return NULL;
	self->jmpbuf_valid = 1;
	rv = XML_Parse(self->itself, s, slen, isFinal);
	self->jmpbuf_valid = 0;
	return Py_BuildValue("i", rv);

Hmm, the things you are read()ing from, are they real files? Or could it be 
that the missing INCREF is in those objects?
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm