[xslt] Segfault when using xsldbg on empty attribute sets
- From: Keith Isdale <k_isdale tpg com au>(by way of Keith Isdale <k_isdale tpg com au>)
- To: xslt <xslt gnome org>
- Subject: [xslt] Segfault when using xsldbg on empty attribute sets
- Date: Fri, 12 Jul 2002 16:18:38 +0000
Hi all,
I've found a bug in the code contributed a while a go. xsldbg crashes when it
sees something like the following in the "XSLT" file
----------------- example code ------
...
<xsl:attribute-set name="empty"/>
....
<xsl:template match="/">
<xsl:element name="item" use-attribute-sets="empty">
<xsl:attribute name="id">
<xsl:value-of select="1"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
------------------ end -----------------------
This was caused by me not expecting a user to supply an empty atribute set.
Which is frequently done in docbook xsl :-( . Attatched is a patch to fix
this. I've attatched an updated files from xsldbg, test6.xsl and test6.xml,
which when you use the "trace" command in xsldbg would have caused the
problem to occur. This so you can verify this fault for yourself and confirm
that the fault is fixed when the patch has been applied.
Daniel: Would you look at applying this patch to libxslt?
Are there any other bugs that I don't know about? I'd like to move xsldbg
into a stable/final state so I can start other projects. A new release for
xsldbg is planned once the last round of changes has been made.
Keith isdale
Index: attributes.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/attributes.c,v
retrieving revision 1.25
diff -r1.25 attributes.c
715c715,716
< if (style && (xslDebugStatus != XSLT_DEBUG_NONE)) {
---
> if (style && style->attributeSets &&
> (xslDebugStatus != XSLT_DEBUG_NONE)) {
718c719
< if (values)
---
> if (values && values->attr)
<?xml version="1.0" ?>
<!--
File : test6.xsl
Author: Keith Isdale <k_isdale@tpg.com.au>
Description: stylesheet for test "test6"
Copyright Reserved Under GPL
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Test xsl:element, xsl:attribute, xsl:attribute-set -->
<xsl:attribute-set name="base">
<xsl:attribute name="href">index.html</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="empty"/>
<xsl:template match="/">
<xsl:element name="item" use-attribute-sets="base">
<xsl:attribute name="id">
<xsl:value-of select="1"/>
</xsl:attribute>
</xsl:element>
<xsl:element name="item" use-attribute-sets="empty">
<xsl:attribute name="id">
<xsl:value-of select="1"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" ?>
<!--
File : test6.xml
Author: Keith Isdale <k_isdale@tpg.com.au>
Description: xml data for stylesheet for test "test6"
Copyright Reserved Under GPL
-->
<result>
<data>2</data>
<data>1</data>
<data>3</data>
<extra/>
</result>
<!-- initialization code for xemacs -->
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]