Commit 7893a468 authored by Nick Wellnhofer's avatar Nick Wellnhofer
Browse files

Avoid infinite recursion after failed param evaluation

Always mark variables as computed even if evaluation fails. This
avoids infinite recursion and a stack overflow if a parameter whose
evaluation failed is looked up again.

Found with afl-fuzz.
parent 1c8e0e55
......@@ -1803,8 +1803,7 @@ xsltBuildVariable(xsltTransformContextPtr ctxt,
elem->tree = tree;
elem->value = xsltEvalVariable(ctxt, elem,
(xsltStylePreCompPtr) comp);
if (elem->value != NULL)
elem->computed = 1;
elem->computed = 1;
return(elem);
}
......
runtime error
Variable 'p' has not been declared.
xmlXPathCompiledEval: evaluation failed
runtime error: file ./bug-194.xsl line 4 element param
Failed to evaluate the expression of variable 'p'.
xmlXPathCompiledEval: evaluation failed
runtime error: file ./bug-194.xsl line 5 element param
Failed to evaluate the expression of variable 'p2'.
no result for ./../docs/bug-194.xml
<x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform" version="1.0">
<x:template match="/">
<x:param name="p" select="$p"/>
<x:param name="p2" select="$p"/>
</x:template>
</x: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