[xmlsec] Re: [xml] error in moving nodes between documents: heap corruption detected

Daniel Veillard veillard at redhat.com
Tue Nov 30 03:20:01 PST 2004


On Tue, Nov 30, 2004 at 12:10:33PM +0100, Tomas Sieger wrote:
> Hi,
>  I found a problem in moving document (D1) nodes into another
> document (D2). It seems that the moved nodes still refer to some
> data in the original document D1, so after D1 gets deleted,
> D2 contains invalid nodes. The invalid nodes are revealed e.g.
> when deleting D1 - glibc reports heap corruption.

  yes. There is a number of dependancies possibles from a node
to its surroundding document:
   - dictionnary for names and short text values
   - namespaces
   - entities references

  Moving nodes between documents is a tricky business.

> The problem appears in libxml2-2.6.15 and newer. libxml2-2.6.14
> does not cause the problem. I've discovered that this commit:
> 
>   http://cvs.gnome.org/viewcvs/libxml2/parser.c?r1=1.391&r2=1.392

  This enforces than nodes from a document always use names from
the document dictionnary. If you want to avoid that, pass the 
XML_PARSE_NODICT option to xmlRead... parsing functions.

  It is not a bug, it is a property of the documents. You can disable it
but you will loose on performances and memory consumption.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



More information about the xmlsec mailing list