[xslt] Segmentation fault fixed but still no cigar
- From: Teppo Peltonen <tpeltone cc hut fi>
- To: xslt gnome org
- Cc: tpeltone cc hut fi
- Subject: [xslt] Segmentation fault fixed but still no cigar
- Date: 15 Apr 2001 06:06:33 +0300
Hello Daniel,
Thank you very much for implementing the parameter passing mechanism
for xsltproc.
However, I still can get my stylesheet working with libxslt. Below you
can find the the minimal test case for the bug. Also, I have included
the fix to get around the segfaults, but I'm afraid that it only is
hiding the real problem which I am unable to grasp at this time... ;-)
Bye, going to get some sleep now,
Teppo
------------------------------------------------------------
[teppo ahven /tmp]$ xsltproc bug.xsl bug.xsl
unregistered variable b
unregistered variable b
xmlXPathEval: evaluation failed
xsltDefaultProcessOneNode: text copy failed
Segmentation fault (core dumped)
[teppo ahven /tmp]$
------------------------------------------------------------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:variable name="a">
<xsl:variable name="b" select="'Hello'"/>
<xsl:value-of select="$b"/>
</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="$a"/>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------
--- libxml2-2.3.6-orig/xpath.c Sun Apr 8 05:35:06 2001
+++ libxml2-2.3.6/xpath.c Sun Apr 15 06:06:35 2001
@@ -7079,7 +7079,9 @@
/*
* Hum are we filtering the result of an XPointer expression
*/
- if (ctxt->value->type == XPATH_LOCATIONSET) {
+ if (ctxt->value != NULL
+ && ctxt->value->type == XPATH_LOCATIONSET) {
+
xmlLocationSetPtr newlocset = NULL;
xmlLocationSetPtr oldlocset;
--- libxslt-0.7.0-orig/libxslt/transform.c Sun Apr 8 05:55:06 2001
+++ libxslt-0.7.0/libxslt/transform.c Sun Apr 15 06:11:58 2001
@@ -2429,15 +2429,19 @@
}
#ifdef DEBUG_PROCESS
- xsltGenericDebug(xsltGenericDebugContext,
- "xsltForEach: select evaluate to %d nodes\n", list->nodeNr);
+ if (list != NULL) {
+ xsltGenericDebug(xsltGenericDebugContext,
+ "xsltForEach: select evaluate to %d nodes\n", list->nodeNr);
+ }
#endif
oldlist = ctxt->nodeList;
ctxt->nodeList = list;
oldContextSize = ctxt->xpathCtxt->contextSize;
oldProximityPosition = ctxt->xpathCtxt->proximityPosition;
- ctxt->xpathCtxt->contextSize = list->nodeNr;
+ if (list != NULL) {
+ ctxt->xpathCtxt->contextSize = list->nodeNr;
+ }
/*
* handle and skip the xsl:sort
@@ -2448,7 +2452,7 @@
replacement = replacement->next;
}
- for (i = 0;i < list->nodeNr;i++) {
+ for (i = 0;list != NULL && i < list->nodeNr;i++) {
ctxt->node = list->nodeTab[i];
ctxt->xpathCtxt->proximityPosition = i + 1;
/* ctxt->insert = oldInsert; */
--- libxslt-0.7.0-orig/libxslt/variables.c Tue Apr 3 05:55:06 2001
+++ libxslt-0.7.0/libxslt/variables.c Sun Apr 15 06:02:52 2001
@@ -145,8 +145,10 @@
if ((ctxt == NULL) || (elem == NULL))
return(-1);
- elem->next = ctxt->varsTab[ctxt->varsNr - 1];
- ctxt->varsTab[ctxt->varsNr - 1] = elem;
+ if (ctxt->varsNr > 0) {
+ elem->next = ctxt->varsTab[ctxt->varsNr - 1];
+ ctxt->varsTab[ctxt->varsNr - 1] = elem;
+ }
ctxt->vars = elem;
return(0);
}
------------------------------------------------------------
--
if (status = UNDER_NUCLEAR_ATTACK) { launch_all_missiles(); } /* B. Godfrey */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]