aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--debugXML.c16
-rw-r--r--valid.c11
3 files changed, 24 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 3178d9f5..825a3814 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Oct 9 12:18:37 CEST 2002 Daniel Veillard <daniel@veillard.com>
+
+ * valid.c: Joe Marcus Clarke reported a segfault on FBsd
+ this was due to uninitialized parts of the validation context
+
Tue Oct 8 23:24:20 CEST 2002 Daniel Veillard <daniel@veillard.com>
* debugXML.c: applied patch from Mark Vakoc except the API
diff --git a/debugXML.c b/debugXML.c
index fabcd128..200fe4e6 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -1355,17 +1355,23 @@ xmlShellPrintXPathError(int errorType, const char *arg)
static void
xmlShellPrintNodeCtxt(xmlShellCtxtPtr ctxt,xmlNodePtr node)
{
- if (!ctxt || !node)
+ FILE *fp;
+
+ if (!node)
return;
+ if (ctxt == NULL)
+ fp = stdout;
+ else
+ fp = ctxt->output;
if (node->type == XML_DOCUMENT_NODE)
- xmlDocDump(ctxt->output, (xmlDocPtr) node);
+ xmlDocDump(fp, (xmlDocPtr) node);
else if (node->type == XML_ATTRIBUTE_NODE)
- xmlDebugDumpAttrList(ctxt->output, (xmlAttrPtr) node, 0);
+ xmlDebugDumpAttrList(fp, (xmlAttrPtr) node, 0);
else
- xmlElemDump(ctxt->output, node->doc, node);
+ xmlElemDump(fp, node->doc, node);
- fprintf(ctxt->output, "\n");
+ fprintf(fp, "\n");
}
/**
diff --git a/valid.c b/valid.c
index df1e6efc..57c42f01 100644
--- a/valid.c
+++ b/valid.c
@@ -4552,9 +4552,9 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
xmlElementPtr elemDecl, int warn, xmlNodePtr parent) {
int ret = 1;
#ifndef LIBXML_REGEXP_ENABLED
- xmlNodePtr last = NULL;
+ xmlNodePtr repl = NULL, last = NULL, tmp;
#endif
- xmlNodePtr repl = NULL, cur, tmp;
+ xmlNodePtr cur;
xmlElementContentPtr cont;
const xmlChar *name;
@@ -4572,6 +4572,9 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
} else {
xmlRegExecCtxtPtr exec;
+ ctxt->nodeMax = 0;
+ ctxt->nodeNr = 0;
+ ctxt->nodeTab = NULL;
exec = xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL);
if (exec != NULL) {
cur = child;
@@ -4763,9 +4766,11 @@ fail:
expr[0] = 0;
xmlSnprintfElementContent(expr, 5000, cont, 1);
list[0] = 0;
+#ifndef LIBXML_REGEXP_ENABLED
if (repl != NULL)
xmlSnprintfElements(list, 5000, repl, 1);
else
+#endif /* LIBXML_REGEXP_ENABLED */
xmlSnprintfElements(list, 5000, child, 1);
if (name != NULL) {
@@ -4798,7 +4803,6 @@ fail:
#ifndef LIBXML_REGEXP_ENABLED
done:
-#endif
/*
* Deallocate the copy if done, and free up the validation stack
*/
@@ -4812,6 +4816,7 @@ done:
xmlFree(ctxt->vstateTab);
ctxt->vstateTab = NULL;
}
+#endif
ctxt->nodeMax = 0;
ctxt->nodeNr = 0;
if (ctxt->nodeTab != NULL) {