You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Jarkko Moilanen <Ja...@uta.fi> on 2003/07/31 13:28:35 UTC

looping causing crash

I have been doing some looping testing with various XML processors.
The testing is done with this simple XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" indent="yes"/>
	<xsl:template match="/">
		<p>Test Page</p>

		<xsl:call-template name="forloop">
			<xsl:with-param name="counter" select="1"/>
		</xsl:call-template>
	</xsl:template>

	<xsl:template name="forloop">
		<xsl:param name="counter"/>
		<xsl:variable name="Datasize" select="40000"/>
		<p><xsl:value-of select="$counter"/></p>

		<xsl:if test="$counter &lt;= $Datasize - 1">
			<xsl:call-template name="forloop">
			<xsl:with-param name="counter" select="$counter
+1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

With Xalan-C 1.4 and Xerces 2.1.0
The crash happens when
<p>17394</p>
Segmentation fault

With Xalan-C 1.5.and Xerces 2.2.0
The crach happens when
<p>18654</p>
Segmentation fault

Does anyone have a glue why?

And I have to admit that the reason for this kind of testing
is purely academical =)

Cheers,
jarkko

****************************************************************
Jarkko Moilanen          "The box said that is needs
Researcher                Windows 95 or better... So I
jm60697@uta.fi            installed Linux."
www.uta.fi/~jm60697
GSM: +358 50 3766 927
****************************************************************
* ITCM | Information Technology and Crisis Management
* http://www.itcm.org
****************************************************************






Re: looping causing crash

Posted by da...@us.ibm.com.



> With Xalan-C 1.4 and Xerces 2.1.0
> The crash happens when
> <p>17394</p>
> Segmentation fault
>
> With Xalan-C 1.5.and Xerces 2.2.0
> The crach happens when
> <p>18654</p>
> Segmentation fault
>
> Does anyone have a glue why?

It's stack overflow from your recursive template.  How many calls you get
depends on the OS and compiler.

Dave