GNOME Bugzilla – Bug 612984
str:replace goes into infinite loop when second argument is empty string
Last modified: 2012-09-04 09:01:17 UTC
This is very easy to demonstrate and is pretty bad. If you accidentally specify an empty string as the second argument to str:replace, xsltproc (or whatever you are using for the transformation) will just hang. Try my test XSL below: $ ./xsltproc --version Using libxml 20707, libxslt 10126 and libexslt 815 xsltproc was compiled against libxml 20707, libxslt 10126 and libexslt 815 libxslt 10126 was compiled against libxml 20707 libexslt 815 was compiled against libxml 20707 $ cat ~/testloop.xsl <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" > <xsl:template match="/*"> <xsl:variable name="loop-replace" select="str:replace('foo', '', 'baz')" /> </xsl:template> </xsl:stylesheet> $ ./xsltproc ~/testloop.xsl ~/testloop.xsl ^C
Created attachment 165390 [details] [review] Rewrite of str:replace This patch should fix this bug.
I think that was fixed when fixing https://bugzilla.gnome.org/show_bug.cgi?id=569703 Daniel