xmlValidateElement could crash for element holding a namespace declaration
* valid.c: xmlValidateElement could crash for element holding a
namespace declaration but not in a namespace. Oliver Fischer
provided the example.
Daniel
diff --git a/valid.c b/valid.c
index 5763354..96b54dd 100644
--- a/valid.c
+++ b/valid.c
@@ -6095,8 +6095,12 @@
}
ns = elem->nsDef;
while (ns != NULL) {
- ret &= xmlValidateOneNamespace(ctxt, doc, elem, elem->ns->prefix,
- ns, ns->href);
+ if (elem->ns == NULL)
+ ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
+ ns, ns->href);
+ else
+ ret &= xmlValidateOneNamespace(ctxt, doc, elem, elem->ns->prefix,
+ ns, ns->href);
ns = ns->next;
}
child = elem->children;