Fix a crash on misformed imported stylesheets
authorDaniel Veillard <veillard@redhat.com>
Fri, 18 Sep 2009 09:43:35 +0000 (11:43 +0200)
committerDaniel Veillard <veillard@redhat.com>
Fri, 18 Sep 2009 09:43:35 +0000 (11:43 +0200)
* libxslt/preproc.c: handle the case where xsl:template parent
  is not an element.

libxslt/preproc.c

index 9a5e9d6..b47d809 100644 (file)
@@ -82,7 +82,7 @@ xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) {
        }
        return(0);
     }
-    if ((parent->ns == NULL) ||
+    if ((parent->ns == NULL) || (parent->type != XML_ELEMENT_NODE) ||
         ((parent->ns != inst->ns) &&
         (!xmlStrEqual(parent->ns->href, inst->ns->href))) ||
        ((!xmlStrEqual(parent->name, BAD_CAST "stylesheet")) &&