+Wed May 31 22:32:44 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+ * libxslt/transform.c: Fixed a difference in processing of
+ xsl:value-of and xsl:text wrt to merging of strings of
+ output-escaped text-nodes. This difference made the
+ optimized string-merging mechanism run out of sync, which
+ led to segfaults in subsequent string reallocations. See
+ bug #343411, reported by Grzegorz Kaczor.
+ * xslt.c: Added check for ctxt->internalized when we parse
+ xsl:text and internalize the strings.
+
Mon May 22 10:32:57 CEST 2006 Kasimier Buchcik <libxml2-cvs@cazic.net>
* libxslt/attributes.c libxslt/documents.c
((target->ns != NULL) &&
(xmlHashLookup2(ctxt->style->cdataSection,
target->name, target->ns->href) != NULL)))) {
- /* OPTIMIZE TODO: xsltCopyText() is also used for attribute content.
- * nodes which must be output as CDATA due to the stylesheet
- */
+ /*
+ * OPTIMIZE TODO: xsltCopyText() is also used for attribute content.
+ */
+ /*
+ * TODO: Since this doesn't merge adjacent CDATA-section nodes,
+ * we'll get: <![CDATA[x]]><!CDATA[y]]>.
+ */
copy = xmlNewCDataBlock(ctxt->output, cur->content,
xmlStrlen(cur->content));
ctxt->lasttext = NULL;
- } else if ((target != NULL) && (target->last != NULL) &&
- (target->last->type == XML_TEXT_NODE) &&
- (target->last->name == xmlStringText) &&
- (cur->name != xmlStringTextNoenc)) {
+ } else if ((target != NULL) &&
+ (target->last != NULL) &&
+ /* both escaped or both non-escaped text-nodes */
+ (((target->last->type == XML_TEXT_NODE) &&
+ (target->last->name == cur->name)) ||
+ /* non-escaped text nodes and CDATA-section nodes */
+ (((target->last->type == XML_CDATA_SECTION_NODE) &&
+ (cur->name == xmlStringTextNoenc)))))
+ {
/*
* we are appending to an existing text node
*/
return(xsltAddTextString(ctxt, target->last, cur->content,
- xmlStrlen(cur->content)));
- } else if ((interned) && (target != NULL) && (target->doc != NULL) &&
- (target->doc->dict == ctxt->dict)) {
+ xmlStrlen(cur->content)));
+ } else if ((interned) && (target != NULL) &&
+ (target->doc != NULL) &&
+ (target->doc->dict == ctxt->dict))
+ {
+ /*
+ * TODO: DO we want to use this also for "text" output?
+ */
copy = xmlNewTextLen(NULL, 0);
if (copy == NULL)
- return NULL;
+ return NULL;
if (cur->name == xmlStringTextNoenc)
copy->name = xmlStringTextNoenc;
- /* OPTIMIZE TODO: get rid of xmlDictOwns() in safe cases; e.g. attribute values don't need the lookup
- * Must confirm that content is in dict
- * (bug 302821)
+
+ /* OPTIMIZE TODO: get rid of xmlDictOwns() in safe cases;
+ * e.g. attribute values don't need the lookup.
+ *
+ * Must confirm that content is in dict (bug 302821)
+ * TODO: Check if bug 302821 still applies here.
*/
if (xmlDictOwns(ctxt->dict, cur->content))
copy->content = cur->content;