After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 318088 - Infinite loop not detected
Infinite loop not detected
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.14
Other All
: Normal normal
: ---
Assigned To: kbuchcik
libxml QA maintainers
: 327470 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-10-06 08:31 UTC by Sorin Ristache
Modified: 2006-07-14 16:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sorin Ristache 2005-10-06 08:31:01 UTC
Please describe the problem:
I apply a XSLT stylesheet with an infinite recursion and the infinite loop is
not detected. Any value I set for --maxdepth is ignored.

Steps to reproduce:
1. Create the maxDepth.xsl file in the same directory as xsltproc.exe.
maxDepth.xsl contains:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <xsl:call-template name="temp"/>
    </xsl:template>
    
    <xsl:template name="temp">
        <xsl:call-template name="temp"/>
    </xsl:template>
</xsl:stylesheet>


2. Apply maxDepth.xsl on any XML file with a command line like:

xsltproc --verbose --maxdepth 100 maxDepth.xsl samples\personal.xml


Actual results:
The template "temp" is called in an infinite loop.

Expected results:
Receive a message like "xsltApplyOneTemplate: loop found ??? try increasing
xsltMaxDepth (--maxdepth)"

Does this happen every time?
Yes

Other information:
No
Comment 1 Sorin Ristache 2005-10-13 11:30:32 UTC
Does anyone check the libxslt bug reports submitted to the GNOME bugzilla ?
Comment 2 Daniel Veillard 2005-10-13 14:40:08 UTC
yes when I have time, same for others. Bugzilla means it's in stable storage
and it won't get lost. you could try the latest 1.1.15, but I doubt it would
change the result, apparently there is a test missing, it does not look
like critically urgent nor hard and will certainly be fixed before next release.

Daniel
Comment 3 Bart Martens 2005-11-26 19:47:30 UTC
When xsltApplyOneTemplateInt is called with notcur=1, then templPush and tempPop
are not called, so templNr is never increased, so templNr never becomes greater
than xsltMaxDepth, thereby allowing infinite recursion.  Maybe caused by the
modification for bug 157859.
Comment 4 Daniel Veillard 2005-11-28 09:10:25 UTC
I'm a bit behind on bug hunting, but since it's in bugzilla this will be
processed, bear with me, the issue is not lost  :-)

Daniel
Comment 5 Vincent Lefevre 2006-04-06 22:27:21 UTC
This has just occurred to me. Any news?
Comment 6 kbuchcik 2006-06-27 13:05:51 UTC
Yes, this issue is currently being processed.
I'll modify the changes made due to bug 157859 and introduce
an other field on xsltTemplate to reflect the "current template rule",
in order to have the template stack reserved for internal processing -
like the counting of nested template calls.
Comment 7 kbuchcik 2006-06-27 13:07:59 UTC
*** Bug 327470 has been marked as a duplicate of this bug. ***
Comment 8 kbuchcik 2006-06-27 13:10:15 UTC
Whoops, correction: the new field goes into xsltTransformContext,
not xsltTemplate.
Comment 9 kbuchcik 2006-07-14 16:27:57 UTC
Fixed in CVS HEAD.

I reduced the default maxdepth from 5000 to 3000, since this
scenario runs out of memory after about 3800 recursions on my win.
Set back to 5000 if that's a problem.