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 170533 - xsltFreeStylesheet for xsl:text
xsltFreeStylesheet for xsl:text
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.13
Other All
: High critical
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-03-16 05:40 UTC by jdenny
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jdenny 2005-03-16 05:40:21 UTC
Steps to reproduce:
1. Compile this program using libxslt 1.1.13, libxml2 2.6.18, and gcc 3.4.0 on
SunOS 5.9 sparc:

  xsltStylesheetPtr cur = NULL;
  xmlDocPtr doc;
  xmlDocPtr doc_copy;

  /* Load the document, copy it, and parse it as a stylesheet. */
  doc = xmlReadFile( argv[1], NULL, 0 );
  doc_copy = xmlCopyDoc(doc, 1);
  xmlSubstituteEntitiesDefault(1);
  xmlLoadExtDtdDefaultValue = 1;
  cur = xsltParseStylesheetDoc(doc_copy);

  /* Free the memory.  Comment this and the problem goes away. */
  xsltFreeStylesheet(cur);

2. Execute it using the name of this XSLT file as argv[1]:

  <?xml version="1.0" encoding="iso-8859-1"?>
  <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >
  <xsl:template match="/">
    <a>
      <xsl:attribute name="href">
        <!-- The problem always seems related to xsl:text. -->
        <xsl:text>#</xsl:text>
        <!-- Add this back and the problem goes away. -->
        <!-- <xsl:value-of select="@id" /> -->
      </xsl:attribute>
    </a>
  </xsl:template>
  </xsl:stylesheet>

3. I consistently get a bus error.

Stack trace:

Thread 2 (Thread 1 (LWP 1))

  • #0 _free_unlocked
    from /usr/lib/libc.so.1
  • #1 free
    from /usr/lib/libc.so.1
  • #2 xmlFreeNodeList
    at tree.c line 3387
  • #3 xmlFreeNodeList
    at tree.c line 3375
  • #4 xmlFreeNodeList
    at tree.c line 3375
  • #5 xmlFreeNodeList
    at tree.c line 3375
  • #6 xmlFreeNodeList
    at tree.c line 3375
  • #7 xmlFreeDoc
    at tree.c line 1166
  • #8 xsltFreeStylesheet
    at xslt.c line 498
  • #9 main
    at test.c line 74

Thread 1 (LWP 1 )

  • #0 _free_unlocked
    from /usr/lib/libc.so.1
  • #1 free
    from /usr/lib/libc.so.1
  • #2 xmlFreeNodeList
    at tree.c line 3387
  • #3 xmlFreeNodeList
    at tree.c line 3375
  • #4 xmlFreeNodeList
    at tree.c line 3375
  • #5 xmlFreeNodeList
    at tree.c line 3375
  • #6 xmlFreeNodeList
    at tree.c line 3375
  • #7 xmlFreeDoc
    at tree.c line 1166
  • #8 xsltFreeStylesheet
    at xslt.c line 498
  • #9 main
    at test.c line 74


Other information:
XML::GDOME::XSLT (0.75) for perl employs similar code and so crashes for just
basic usage:

use XML::GDOME::XSLT;
my $xslt_doc = XML::GDOME->createDocFromURI( $ARGV[0] );
my $xslt_parser = XML::GDOME::XSLT->new();
my $xslt = $xslt_parser->parse_stylesheet( $xslt_doc );
Comment 1 William M. Brack 2005-03-16 11:16:05 UTC
This problem was caused by the lack of a dictionary on the stylesheet document 
(an expected result of xmlCopyDoc, and certainly not an error on your part).  
Fixed in CVS (libxslt/xslt.c), but only tested on x86 (should be ok on all 
architectures).  Thanks for the report, and the clear test case.

Bill
Comment 2 jdenny 2005-03-16 17:54:07 UTC
I hope this is the right place to ask this question....

I'm not familiar with the internals of libxslt.  If I replace libxslt/xslt.c 
in 1.1.13 with the snapshot version, should that be sufficient to get a stable 
build of libxslt?  Is there a better approach?

Btw, I noticed that the tar.gz for the latest CVS snapshot is actually 1.1.12.

Joel
Comment 3 William M. Brack 2005-03-17 00:08:22 UTC
Oops - looks like the CVS-snapshot on xmlsoft.org has a problem.  It will get 
fixed later today.  If you are in a hurry, you can also get the cvs directly 
using "cvs -z3 co libxslt" (see http://developer.gnome.org/tools/cvs.html).

In this particular case (this is actually the first bug to be fixed since the 
last release) it would be sufficient to just copy the changed module 
(libxslt/xslt.c) from the cvs directory into the release directory and re-
compile the source.  As a general rule, however, the safest thing is to just 
take the cvs snapshot and compile it in the normal way (./autogen.sh [optional 
config params] followed by make).  In this manner, you will be assured to get 
any other fixes which have been made.

Although I'm happy to respond to this sort of question via Bugzilla, it would 
actually have been better had you posed it on the mailing list 
(xslt@gnome.org).  In that manner, others who may have a similar question (but 
are reluctant to ask it), as well as future users who may do mailing list 
searches, could possibly benefit from the response.

Regards,
Bill
Comment 4 jdenny 2005-03-17 00:17:26 UTC
Thanks very much for your help.

I will pass the fix on to our sys admin.  If there are any additional problems 
related to this bug, I'll post a follow-up in Bugzilla.

In the future, I will target the mailing list for the more general questions.

Joel
Comment 5 Daniel Veillard 2005-03-17 10:08:58 UTC
I fixed the libxslt CVS snapshot generation on xmlsoft.org,

Daniel
Comment 6 jdenny 2005-03-17 17:30:12 UTC
The patch is working great.  Thanks again.

Joel
Comment 7 Daniel Veillard 2005-09-05 09:41:54 UTC
This should be closed by release of libxslt-1.1.15

  thanks,

Daniel