[xml] patch: namespace corruption in xmlParseBalancedChunkMemoryRecover

Can someone commit this patch for me? I am away and can't commit to CVS right now.

Patch fixes tree corruption when a doc is passed to xmlParseBalancedChunkMemoryRecover and something using the XML namespace is parsed from the chunk. This patch makes sure that the XML namespapce has already been created on the origional document and sets oldNS from the origional document on newDoc. This way the XML namespace from the origional document will be used on the tree being created, so when tree is added to origional document and newDoc is destroyed the namespace will be valid. Currently once newDoc is free'd (causing the XML namespace created just for that document to be freed), its use in the new tree is now garbage.

rans the tests and they were fine.

Index: parser.c
RCS file: /cvs/gnome/libxml2/parser.c,v
retrieving revision 1.453
diff -c -r1.453 parser.c
*** parser.c    13 Jul 2006 06:29:52 -0000      1.453
--- parser.c    11 Sep 2006 18:56:23 -0000
*** 11903,11908 ****
--- 11903,11911 ----
      } else {
        ctxt->myDoc = newDoc;
        newDoc->children->doc = doc;
+       /* Ensure that doc has XML spec namespace */
+       xmlSearchNsByHref(doc, (xmlNodePtr)doc, XML_XML_NAMESPACE);
+       newDoc->oldNs = doc->oldNs;
      ctxt->instate = XML_PARSER_CONTENT;
      ctxt->depth = depth;
*** 11963,11968 ****
--- 11966,11972 ----
      newDoc->intSubset = NULL;
      newDoc->extSubset = NULL;
+       newDoc->oldNs = NULL;

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