diff options
author | William M. Brack <wbrack@src.gnome.org> | 2007-01-24 19:08:38 +0000 |
---|---|---|
committer | William M. Brack <wbrack@src.gnome.org> | 2007-01-24 19:08:38 +0000 |
commit | 77849f1aa55ccf8b7c395256ce33a0a277c30771 (patch) | |
tree | 35fbbd8862b6232a1053287a50c20ad329b52d4a | |
parent | ba3e40899a0afef8161a0beb79211b346c65a1c6 (diff) | |
download | libxslt-77849f1aa55ccf8b7c395256ce33a0a277c30771.tar.gz libxslt-77849f1aa55ccf8b7c395256ce33a0a277c30771.tar.bz2 libxslt-77849f1aa55ccf8b7c395256ce33a0a277c30771.zip |
added check for memory allocation error (bug #400242); fixed "type-punned
* libxslt/pattern.c: added check for memory allocation error (bug #400242);
fixed "type-punned pointer" warnings.
* libxslt/xsltutils.c: added checks for memory allocation error
(bug #400242)
* restored NEWS, doc/EXSLT/downloads.html which mysteriously disappeared
from svn
svn path=/trunk/; revision=1419
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | NEWS | 12 | ||||
-rw-r--r-- | doc/EXSLT/downloads.html | 2 | ||||
-rw-r--r-- | libxslt/pattern.c | 29 | ||||
-rw-r--r-- | libxslt/xsltutils.c | 6 |
5 files changed, 45 insertions, 13 deletions
@@ -1,3 +1,12 @@ +Wed Jan 24 11:05:28 PST 2007 William Brack <wbrack@mmm.com.hk> + + * libxslt/pattern.c: added check for memory allocation error + (bug #400242); fixed "type-punned pointer" warnings. + * libxslt/xsltutils.c: added checks for memory allocation error + (bug #400242) + * restored NEWS, doc/EXSLT/downloads.html which mysteriously + disappeared from svn + Wed Jan 17 14:20:18 CET 2007 Daniel Veillard <daniel@veillard.com> * configure.in doc/*: preparing release of 1.1.20 @@ -10,6 +10,18 @@ ChangeLog.html to the CVS at http://cvs.gnome.org/viewcvs/libxslt/ code base.Those are the public releases made: +1.1.20: Jan 17 2007: + - Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability + patches (Roland Illig) + - Bug fixes: Result Value Tree handling fix (William Brack), function + parameters fix (William), uninitialized variable (Kjartan Maraas), + empty text node handling (William), plugin support and test fixes (William), + fragment support fixes (William) + - Improvements: python stylesheet compare and transform context + access (Nic Ferrier), EXSLT string replace support (Joel Reed), + xsltproc better low level error handling (Mike Hommey and William) + + 1.1.19: Nov 29 2006: - Bug fixes: entities within attributes (William Brack), Python detection problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result diff --git a/doc/EXSLT/downloads.html b/doc/EXSLT/downloads.html index 88295e55..223ecefa 100644 --- a/doc/EXSLT/downloads.html +++ b/doc/EXSLT/downloads.html @@ -20,7 +20,7 @@ provides <a href="http://garypennington.net/libxml2/">Solaris binaries</a>. <a href="mailto:Steve.Ball@zveno.com">Steve Ball</a> provides <a href="http://www.zveno.com/open_source/libxml2xslt.html">Mac Os X binaries</a>.</p><p><a name="Contribs" id="Contribs">Contribs:</a></p><p>I do accept external contributions, especially if compiling on another platform, get in touch with me to upload the package. I will keep them in the -<a href="ftp://xmlsoft.org/contribs/">contrib directory</a></p><p>Libxslt is also available from CVS:</p><ul><li><p>The <a href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome&dir=libxslt">Gnome +<a href="ftp://xmlsoft.org/contribs/">contrib directory</a></p><p>Libxslt is also available from CVS:</p><ul><li><p>The <a href="http://cvs.gnome.org/bonsai/rview.cgi?cvsroot=/cvs/gnome">Gnome CVS base</a>. Check the <a href="http://developer.gnome.org/tools/cvs.html">Gnome CVS Tools</a> page; the CVS module is <b>libxslt</b>.</p> </li> diff --git a/libxslt/pattern.c b/libxslt/pattern.c index c3433c9a..03f71226 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -142,7 +142,7 @@ xsltNewCompMatch(void) { cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch)); if (cur == NULL) { xsltTransformError(NULL, NULL, NULL, - "xsltNewCompMatch : malloc failed\n"); + "xsltNewCompMatch : out of memory error\n"); return(NULL); } memset(cur, 0, sizeof(xsltCompMatch)); @@ -2066,7 +2066,12 @@ xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, int xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, const xmlChar *mode, const xmlChar *modeURI) { - xsltCompMatchPtr pat, list, *top = NULL, next; + xsltCompMatchPtr pat, list, next; + /* + * 'top' will point to style->xxxMatch ptr - declaring as 'void' + * avoids gcc 'type-punned pointer' warning. + */ + void **top = NULL; const xmlChar *name = NULL; float priority; /* the priority */ @@ -2076,6 +2081,8 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, priority = cur->priority; pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem, style, NULL, 1); + if (pat == NULL) + return(-1); while (pat) { next = pat->next; pat->next = NULL; @@ -2097,24 +2104,24 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, if (pat->steps[0].value != NULL) name = pat->steps[0].value; else - top = (xsltCompMatchPtr *) &(style->attrMatch); + top = &(style->attrMatch); break; case XSLT_OP_CHILD: case XSLT_OP_PARENT: case XSLT_OP_ANCESTOR: - top = (xsltCompMatchPtr *) &(style->elemMatch); + top = &(style->elemMatch); break; case XSLT_OP_ROOT: - top = (xsltCompMatchPtr *) &(style->rootMatch); + top = &(style->rootMatch); break; case XSLT_OP_KEY: - top = (xsltCompMatchPtr *) &(style->keyMatch); + top = &(style->keyMatch); break; case XSLT_OP_ID: /* TODO optimize ID !!! */ case XSLT_OP_NS: case XSLT_OP_ALL: - top = (xsltCompMatchPtr *) &(style->elemMatch); + top = &(style->elemMatch); break; case XSLT_OP_END: case XSLT_OP_PREDICATE: @@ -2130,20 +2137,20 @@ xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, if (pat->steps[0].value != NULL) name = pat->steps[0].value; else - top = (xsltCompMatchPtr *) &(style->piMatch); + top = &(style->piMatch); break; case XSLT_OP_COMMENT: - top = (xsltCompMatchPtr *) &(style->commentMatch); + top = &(style->commentMatch); break; case XSLT_OP_TEXT: - top = (xsltCompMatchPtr *) &(style->textMatch); + top = &(style->textMatch); break; case XSLT_OP_ELEM: case XSLT_OP_NODE: if (pat->steps[0].value != NULL) name = pat->steps[0].value; else - top = (xsltCompMatchPtr *) &(style->elemMatch); + top = &(style->elemMatch); break; } if (name != NULL) { diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index 7f37fdc2..f3007693 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -2098,13 +2098,17 @@ xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) { xpathCtxt = XSLT_CCTXT(style)->xpathCtxt; xpathCtxt->doc = style->doc; } else - xpathCtxt = xmlXPathNewContext(style->doc); + xpathCtxt = xmlXPathNewContext(style->doc); #else xpathCtxt = xmlXPathNewContext(style->doc); #endif + if (xpathCtxt == NULL) + return NULL; xpathCtxt->dict = style->dict; } else { xpathCtxt = xmlXPathNewContext(NULL); + if (xpathCtxt == NULL) + return NULL; } /* * Compile the expression. |