Re: [xslt] Infinite recursion via func:function seg faults



On Wed, Apr 01, 2009 at 11:10:30AM +0200, Mark Howe wrote:
> Hi,
>   <xsl:template match="/">
>     <test>
>       <xsl:value-of select="abc:bad_test()"/>
>       <!-- <xsl:call-template name="abc:bad_test"/> -->
>     </test>
>   </xsl:template>
>
>   <func:function name="abc:bad_test">
>     <xsl:param name="length"/>
>     <func:result>
>       <xsl:value-of select="abc:bad_test()"/>
>     </func:result>
>   </func:function>
>
>   <xsl:template name="abc:bad_test">
>     <xsl:param name="length"/>
>     <xsl:call-template name="abc:bad_test"/>
>   </xsl:template>
[...]
> If I call it against itself using xsltproc I get a seg fault. If I
> comment out
>
> <xsl:value-of select="abc:bad_test()"/>
>
> and uncomment
>
> <xsl:call-template name="abc:bad_test"/>
>
> I get
>
> runtime error: file xteriorize/xcathedra/bad_test.xsl line 25 element
> param xsltApplyXSLTTemplate: A potential infinite template recursion was
> detected.
>
> etc. I deduce from this that there is no deep recursion test (or indeed
> stack overflow) checking on func:function-type recursion.

  right but the two code path are completely different.

> Obviously the error is in my application code, but it would be extremely
> helpful if LibXSLT could say something more informative than
> 'segmentation fault' in response.

  Fixed in git, not too hard...

paphio:~/XSLT -> valgrind --leak-check=full xsltproc/xsltproc test.xsl
test.xsl
{abc}bad_test: detected a recursion
xmlXPathCompiledEval: evaluation failed
runtime error: file test.xsl line 20 element value-of
XPath evaluation returned no result.
<?xml version="1.0"?>
<test/>
paphio:~/XSLT ->

  Thanks for the report !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]