Re: [xml] stack corruption (2.5.4)



On Wed, Apr 30, 2003 at 11:17:24AM +0100, Gary Pennington sun com wrote:
I have an intermittent problem with stack corruption that appears to be
caused by libxml2. I'll describe the problem, any pointers are appreciated.
[...]
              /*
               * This hack is required to force libxml to recognize the
               * document structure without having to validate. This is
               * achieved by forcing external DTD parsing.
               */
              xmlFreeDtd(info.ktx_doc->extSubset);
              info.ktx_doc->extSubset =
                  xmlParseDTD(info.ktx_doc->intSubset->ExternalID,
                      info.ktx_doc->intSubset->SystemID);
[...]
After the above, I go ahead and build the rest of my document. Now, when
I call xmlValidateDocument() and then save the document (xmlSaveFormatFile)
I get a core dump and stack corruption on the next line after my function
returns. If I comment out the call to xmlValidateDocument(), no corruption
and no problems.

However, this problem is really intermittent. If I make other changes to my
application, e.g. adding tracing details, then the problem can return, but
only if I call xmlValidateDocument(). The constant factors are:

xmlValidateDocument() called: Sometimes I get a corrupt stack and SIGSEGV
xmlValidateDocument() NOT called: Never a problem.

Another colleague developing a separate application contacted me today and
he's experiencing the same intermittent problem, which makes more think
it's more likely the problem is in libxml2 than my application.

My questions are:

1. Is this a known problem in 2.5.4?

  Not specifically

2. If so, will an upgrade to 2.5.7 fix it?
3. Is the "hack" I'm using above likely to be the cause of the problem?

  This should work, but to debug this I would need a complete example
including the DTD. Also when a document is parsed and has a DTD associated
there are a number of other pointer references made. This includes:
   - the DTD node is made a child of the document node
   - pointers from the DTD to the document
   - ID/IDREF references 
I think the 2 first ones are missing with your approach, but I can't guess
if this may be the source of the problem.
  To me it sounds cleaner to keep the DTD separate and use xmlValidateDtd()
once the document is built, unless you need to have informations about the
DTd while building the document.

Daniel

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



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