On Wed, Sep 08, 2010 at 06:48:18PM +0200, Mike Hommey wrote:
> On Wed, Sep 08, 2010 at 02:14:17PM +0000, brian m. carlson wrote:
> > On Wed, Sep 08, 2010 at 09:30:27AM +0200, Mike Hommey wrote:
> > > Works for me with that xsd and a random svg. A likely problem is that
> > > you run out of *stack* memory. Try fiddling with ulimit -s.
> > > Having your logo.svg file would be helpful to track down the problem,
> > > though.
> >
> > Actually, I've determined that "xmllint /tmp/SVG.xsd" is sufficient to
> > trigger the problem. I have the following limits set:
> >
> > lakeview ok % ulimit -a
> > -t: cpu time (seconds) unlimited
> > -f: file size (blocks) unlimited
> > -d: data seg size (kbytes) unlimited
> > -s: stack size (kbytes) unlimited
> > -c: core file size (blocks) 0
> > -m: resident set size (kbytes) 1048576
> > -u: processes unlimited
> > -n: file descriptors 1024
> > -l: locked-in-memory size (kb) 64
> > -v: address space (kb) unlimited
> > -x: file locks unlimited
> > -i: pending signals 16382
> > -q: bytes in POSIX msg queues 819200
> > -e: max nice 0
> > -r: max rt priority 0
> >
> > and I still have a problem. I don't think the RSS value works with this
> > kernel, but even if it does, I don't think only 1 GiB is unreasonable
> > for RSS.
> >
> > I can reproduce the problem consistently, so if there's something you'd
> > like me to do to test it, let me know.
>
> I could reproduce with xmllint SVG.xsd. It turns out it doesn't like the
> xmlns:xml CDATA #FIXED "http://www.w3.org/XML/1998/namespace"
>
> declaration, and the error message is actually wrong.
Can you try the attached patch, from upstream?
Cheers,
Mike
diff --git a/SAX2.c b/SAX2.c
index 84c1f00..c0482c0 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -2242,8 +2242,12 @@ xmlSAX2StartElementNs(void *ctx,
if ((URI != NULL) && (prefix == pref))
ret->ns = ns;
} else {
- xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
- return;
+ /*
+ * any out of memory error would already have been raised
+ * but we can't be garanteed it's the actual error due to the
+ * API, best is to skip in this case
+ */
+ continue;
}
#ifdef LIBXML_VALID_ENABLED
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
diff --git a/tree.c b/tree.c
index 1e1a23a..24db82a 100644
--- a/tree.c
+++ b/tree.c
@@ -721,8 +721,19 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
return(NULL);
- if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xml")))
- return(NULL);
+ if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) {
+ /* xml namespace is predefined, no need to add it */
+ if (xmlStrEqual(href, XML_XML_NAMESPACE))
+ return(NULL);
+
+ /*
+ * Problem, this is an attempt to bind xml prefix to a wrong
+ * namespace, which breaks
+ * Namespace constraint: Reserved Prefixes and Namespace Names
+ * from XML namespace. But documents authors may not care in
+ * their context so let's proceed.
+ */
+ }
/*
* Allocate a new Namespace and fill the fields.