[xslt] Bug regarding libxslt and XML_USE_BUFFER_CONTENT
- From: Thorsten Meinl <Thorsten meinl bnv-bamberg de>
- To: xslt gnome org
- Subject: [xslt] Bug regarding libxslt and XML_USE_BUFFER_CONTENT
- Date: Sun, 16 Dec 2001 19:27:20 +0100
Hello everybody,
I think I just found a serious bug in libxslt 1.0.9. I compiled
libxml2-2.4.12 with XML_USE_BUFFER_CONTENT (god knows why :-)). Afterwards
libxslt fell over hundreds of errors while running the tests. I think the
problem is very easy:
There is a define IS_BLANK_NODE in xslt.c which tests for "empty" nodes:
<snip outOf="xslt.c">
#define IS_BLANK_NODE(n) \
(((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
</snip>
The second statement does not works for -DXML_USE_BUFFER_CONTENT, because the
xmlNodePtr looks slightly different in this case:
<snip from="libxml/tree.h">
#ifndef XML_USE_BUFFER_CONTENT
xmlChar *content; /* the content */
#else
xmlBufferPtr content; /* the content in a buffer */
#endif
</snip>
So content is a pointer to something else and therefore xsltIsBlank reads
garbage and fails. So my suggestion to solve it in this place (maybe it
crashes in several other places):
<snip from="xslt.c">
#ifndef XML_USE_BUFFER_CONTENT
#define IS_BLANK_NODE(n) \
(((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
#else
#define IS_BLANK_NODE(n) \
(((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content->content)))
#endif
</snip>
Maybe you could also mention this problem in README or INSTALL.
Greetings
Thorsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]