Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-715

NULL pointer access => crash

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • CurrentCVS
    • CurrentCVS
    • XalanC
    • Any

    Description

      Using a xalan:nodeset with an empty parameter causes it to return nodeset with no data, no parents, completly empty, which in further operations causes a NULL pointer access in release or debug assertion in debug.
      Maybe it's not a "very proper" use of xalan:nodeset, but IMHO crash/assertion is not the correct behaviour at all.

      Here is an example xslt to reproduce crash:
      <?xml version='1.0' encoding='windows-1251'?>
      <xsl:stylesheet exclude-result-prefixes="xalan" xmlns:xalan = "http://xml.apache.org/xalan" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="html" indent="yes" encoding='windows-1251'/>
      <xsl:strip-space elements="*"/>

      <xsl:template name="head-with-info">
      <xsl:param name="head"/>
      <xsl:param name="info"/>
      <xsl:if test="xalan:nodeset($head)/node()">
      <div class="heading"><xsl:copy-of select="$head"/></div>
      </xsl:if>
      <xsl:if test="string-length($info)>0 and xalan:nodeset($info)/node()">
      <div class="group-info"><xsl:copy-of select="$info"/></div>
      </xsl:if>
      </xsl:template>
      <xsl:template match="*" name="test">
      <xsl:value-of select="test_node/inner_test"/>
      <xsl:call-template name="head-with-info">
      <!-- <xsl:with-param name="head"><span>test head</span></xsl:with-param> -->
      <xsl:with-param name="info"><span>test info</span></xsl:with-param>
      </xsl:call-template>
      </xsl:template>

      </xsl:stylesheet>

      Attachments

        1. crash.xsl
          1 kB
          Michael Kupchuk
        2. empty-nodeset-patch.diff
          1 kB
          Steven J. Hathaway
        3. empty-nodeset-patch.diff-rev1
          2 kB
          Steven J. Hathaway
        4. test.xml
          0.1 kB
          Michael Kupchuk

        Activity

          People

            shathaway Steven J. Hathaway
            michael.kupchuk Michael Kupchuk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: