[xslt] element-available function crash



Testing libxslt-1.0.17, Windows 2000, VC++6 (SP5)

I get a crash from the following stylesheet using the element-available
function.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:saxon="http://icl.com/saxon"; extension-element-prefixes="saxon"
version="1.0">
<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:text>
  saxon:preview .... </xsl:text>
  <xsl:value-of select="element-available('saxon:preview')"/>
  <xsl:text>
  saxon:jump   .... </xsl:text>
  <xsl:value-of select="element-available('saxon:jump')"/>
  <xsl:text>
  preview .... </xsl:text>
  <xsl:value-of select="element-available('preview')"/>
</xsl:template>

</xsl:stylesheet>

The crash occurs in libxslt\functions.c:xsltElementAvailableFunction()
where xmlSearchNS() returns NULL and the following line assumes a valid
xmlNsPtr and tries to access the structure.

I've attached a diff file that adds a test for NULL being returned from
xmlSearchNS().
The stylesheet then works returns the result I'd expect in this case, but
I'm not sure if there are any other consequences that I haven't noticed with
the rest of the function.

Thanks,
Richard

libxslt_element_available.diff



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