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 680938 - libxslt does not signal an error on invalid xsl:key
libxslt does not signal an error on invalid xsl:key
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-31 22:47 UTC by Vincent Lefevre
Modified: 2012-09-07 06:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Vincent Lefevre 2012-07-31 22:47:32 UTC
I reported this bug yesterday on

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683353

and I could reproduce it after recompiling libxslt from the GIT repository.

Consider the following stylesheet:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="var"/>
<xsl:key name="key" match="*[@id != $var]" use="''"/>
</xsl:stylesheet>

The XSLT 1.0 specifications say in 12.2:

  It is an error for the value of either the use attribute or the
  match attribute to contain a VariableReference.

and in 17:

  A conforming XSLT processor must signal any errors except for
  those that this document specifically allows an XSLT processor
  not to signal.

So, since the match attribute contains $var, one would expect an error to be signaled. But:

ypig:~> ~/software/libxslt/xsltproc/xsltproc tst.xsl tst.xsl
<?xml version="1.0"?>




ypig:~> ~/software/libxslt/xsltproc/xsltproc --version
Using libxml 20800, libxslt 10126-GITv1.1.26-32-g8785a2f and libexslt 815
xsltproc was compiled against libxml 20800, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20800
libexslt 815 was compiled against libxml 20800
Comment 1 Daniel Veillard 2012-09-07 06:31:50 UTC
Okay, fixed upstream:

thinkpad:~/XSLT -> xsltproc/xsltproc 680938.xsl 680938.xsl
XPath error : Forbidden variable
//*[@id != $var]
               ^
compilation error: file 680938.xsl line 5 element key
xsl:key : XPath pattern compilation failed '//*[@id != $var]'
thinkpad:~/XSLT -> echo $?
5
thinkpad:~/XSLT -> 

in commit:

  http://git.gnome.org/browse/libxslt/commit/?id=0ae3194eb58d954d0896ef05e3dacf76350a8bc2

this extra libxml2 commit improves the error message

  http://git.gnome.org/browse/libxml2/commit/?id=47881284aeaeeb93b3444419adeffc9e11ed1093

 thanks !

Daniel