[xml] [Fwd: [xml-libxml] dangling doc setfaults]



I inadvertently posted this to the xml-libxml list, but meant it
for this one.

Since I originally posted it, Petr informed me that the 1st problems
(xmlIOParseDTD) have already been discussed (I saw the messages, but didn't connect!) and taken care of in CVS.

But I wanted to repost this here, in case a similar bug is lurking
in xmlParseBalancedChunkMemory that Daniel might recognize, or whether
it suggests a way that XML::LibXML should be dealing with it.

Thanks!
bruce

-------- Original Message --------
Subject: [xml-libxml] dangling doc setfaults
Date: Thu, 08 May 2003 15:03:58 -0400
From: Bruce Miller <bruce miller nist gov>
Organization: NIST
To: xml-libxml axkit org

Hi Daniel and friends;
Somewhere after late 2.4.x versions, something changed in libxml2
that is causing mysterious segfaults.  I'm using it thru XML::LibXML,
so I don't have a nice compact c program to demo it.

I'm also not completely clear on either libxml2's conventions
about whether a node's doc should always be non-NULL, or should
at least point to itself.  Nor am I clear if XML::LibXML has added
any assumptions about node->doc (I know they're using _private to advantage).

At any rate, I can at least isolate one situation:
In xmlIOParseDTD (and I assume xmlSAXParseDTD), a parsing context
is set up and a container document is hooked in. After parsing, the DTD (ctxt->myDoc->extSubset ) is yanked out and the document & context are freed.

Unfortunately, the resulting DTD nodes have doc fields that are all pointing
to that now-freed document!  As I said, I'm not sure if they should
be null [eg. xmlSetTreeDoc(ret,NULL)] or self references [eg. xmlSetTreeDoc(ret,ret) ], but pointing to random memory's kinda bad. :>

I'm also having trouble with XML::LibXML's parse_xml_chunk (which ultimately
calls xmlParseBalancedChunkMemory) and I suspect it's something related,
but I'm less clear where/how the cleanup should be done.



---------------------------------------------------------------------
To unsubscribe, e-mail: xml-libxml-unsubscribe axkit org
For additional commands, e-mail: xml-libxml-help axkit org





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