Re: [xml] xpathEval namespace axis corruption/segfault

On Mon, Mar 10, 2008 at 06:43:02PM -0700, William M. Brack wrote:
Martin (gzlist) wrote:
I attach a simple python script ( that seems to
 reference uninitialised memory, or crash the interpreter.

 I tried the simplest C equivalent I could cook up from the docs
 (attached libxml2_nocrash.c) which behaves itself, perhaps
 the problem's in the python bindings. Could someone with a good
 understanding of the lib can get a better idea of what exactly is


I traced through quite a bit, and was able to isolate where and what
the problem is.  Unfortunately, I can't spend much time on libxml2
for the next couple of weeks, so I have opened a bug
( which describes
how far I got with it.

  yup, agreed with your analysis. That the only case where nodes returned
from an XPath query do not pertain to the document and hence have a different

Perhaps another list member may be able to pursue this?  Python
bindings are always fun to work on....

  I managed to find a minimalist but correct way to fix this, basically
get python to destroy the namespace node when it garbage collect the
associated python object and remove it from the nodeset before it is being
freed, this seems to work quite well actually. Patch attached, I will also
commit a specific regression test. Note that libxslt/python/types.c need
to be patched too.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

Attachment: pyxpathns.patch
Description: Text document

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]