Commit 6c99c519 authored by Nick Wellnhofer's avatar Nick Wellnhofer

Crash when passing an uninitialized variable to document()

https://bugzilla.gnome.org/show_bug.cgi?id=685330

Missing check for NULL
parent ad0e36fd
......@@ -260,7 +260,7 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
obj = valuePop(ctxt);
ret = xmlXPathNewNodeSet(NULL);
if (obj->nodesetval) {
if ((obj != NULL) && obj->nodesetval) {
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
valuePush(ctxt,
xmlXPathNewNodeSet(obj->nodesetval->nodeTab[i]));
......@@ -280,7 +280,8 @@ xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs)
}
}
xmlXPathFreeObject(obj);
if (obj != NULL)
xmlXPathFreeObject(obj);
if (obj2 != NULL)
xmlXPathFreeObject(obj2);
valuePush(ctxt, ret);
......
......@@ -178,6 +178,7 @@ EXTRA_DIST = \
bug-177.xml \
bug-178.xml \
bug-179.xml \
bug-180.xml \
character.xml \
array.xml \
items.xml
......
......@@ -187,6 +187,7 @@ EXTRA_DIST = \
bug-177.out bug-177.xsl \
bug-178.out bug-178.xsl \
bug-179.out bug-179.xsl \
bug-180.out bug-180.xsl bug-180.err \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
......
runtime error: file ./bug-180.xsl line 4 element copy-of
Variable 'xxx' has not been declared.
XPath error : Stack usage errror
xmlXPathCompiledEval: 1 objects left on the stack.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:copy-of select=" * | document($xxx) "/>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment