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

[xml] cvs version and xmlParseBalancedChunkMemoryRecover()



Hallo Daniel,
hallo all,

while testing my new code for XML::LibXML (the libxml2 perl binding) 
I found some new code in xmlParseBalancedChunkMemoryRecover() in parser.c.
This code was not there in 2.4.26 but is quite dangerous as it makes some 
of my tests fail.

I am glad to be able of providing a patch that catches the dangerous case
and makes the parser run smooth again :)

thanks
Christian
--- parser.c	Fri Oct 25 18:25:51 2002
+++ parser.c.new	Fri Oct 25 18:15:53 2002
@@ -9831,11 +9831,15 @@
     ctxt->validate = 0;
     ctxt->loadsubset = 0;
 
-    content = doc->children;
-    doc->children = NULL;
-    xmlParseContent(ctxt);
-    doc->children = content;
-   
+    if ( doc != NULL ){
+        content = doc->children;
+        doc->children = NULL;
+        xmlParseContent(ctxt);
+        doc->children = content;
+    }
+    else {
+        xmlParseContent(ctxt);
+    }
     if ((RAW == '<') && (NXT(1) == '/')) {
 	ctxt->errNo = XML_ERR_NOT_WELL_BALANCED;
 	if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))


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