Skip to content
Snippets Groups Projects
Commit 749151840cdc authored by William M. Brack's avatar William M. Brack
Browse files

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
parent a98cc4fa5311
No related branches found
No related tags found
No related merge requests found
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> Wed Jan 17 14:20:18 CET 2007 Daniel Veillard <daniel@veillard.com>
* configure.in doc/*: preparing release of 1.1.20 * configure.in doc/*: preparing release of 1.1.20
......
...@@ -10,6 +10,18 @@ ...@@ -10,6 +10,18 @@
to the CVS at to the CVS at
http://cvs.gnome.org/viewcvs/libxslt/ http://cvs.gnome.org/viewcvs/libxslt/
code base.Those are the public releases made: 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: 1.1.19: Nov 29 2006:
- Bug fixes: entities within attributes (William Brack), Python detection - Bug fixes: entities within attributes (William Brack), Python detection
problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<a href="mailto:Steve.Ball@zveno.com">Steve Ball</a> provides <a href="http://www.zveno.com/open_source/libxml2xslt.html">Mac Os X <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 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 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&amp;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> 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> page; the CVS module is <b>libxslt</b>.</p>
</li> </li>
......
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch)); cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch));
if (cur == NULL) { if (cur == NULL) {
xsltTransformError(NULL, NULL, NULL, xsltTransformError(NULL, NULL, NULL,
"xsltNewCompMatch : malloc failed\n"); "xsltNewCompMatch : out of memory error\n");
return(NULL); return(NULL);
} }
memset(cur, 0, sizeof(xsltCompMatch)); memset(cur, 0, sizeof(xsltCompMatch));
...@@ -2066,7 +2066,12 @@ ...@@ -2066,7 +2066,12 @@
int int
xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur,
const xmlChar *mode, const xmlChar *modeURI) { 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; const xmlChar *name = NULL;
float priority; /* the priority */ float priority; /* the priority */
...@@ -2076,6 +2081,8 @@ ...@@ -2076,6 +2081,8 @@
priority = cur->priority; priority = cur->priority;
pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem, pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem,
style, NULL, 1); style, NULL, 1);
if (pat == NULL)
return(-1);
while (pat) { while (pat) {
next = pat->next; next = pat->next;
pat->next = NULL; pat->next = NULL;
...@@ -2097,8 +2104,8 @@ ...@@ -2097,8 +2104,8 @@
if (pat->steps[0].value != NULL) if (pat->steps[0].value != NULL)
name = pat->steps[0].value; name = pat->steps[0].value;
else else
top = (xsltCompMatchPtr *) &(style->attrMatch); top = &(style->attrMatch);
break; break;
case XSLT_OP_CHILD: case XSLT_OP_CHILD:
case XSLT_OP_PARENT: case XSLT_OP_PARENT:
case XSLT_OP_ANCESTOR: case XSLT_OP_ANCESTOR:
...@@ -2101,7 +2108,7 @@ ...@@ -2101,7 +2108,7 @@
break; break;
case XSLT_OP_CHILD: case XSLT_OP_CHILD:
case XSLT_OP_PARENT: case XSLT_OP_PARENT:
case XSLT_OP_ANCESTOR: case XSLT_OP_ANCESTOR:
top = (xsltCompMatchPtr *) &(style->elemMatch); top = &(style->elemMatch);
break; break;
case XSLT_OP_ROOT: case XSLT_OP_ROOT:
...@@ -2106,5 +2113,5 @@ ...@@ -2106,5 +2113,5 @@
break; break;
case XSLT_OP_ROOT: case XSLT_OP_ROOT:
top = (xsltCompMatchPtr *) &(style->rootMatch); top = &(style->rootMatch);
break; break;
case XSLT_OP_KEY: case XSLT_OP_KEY:
...@@ -2109,8 +2116,8 @@ ...@@ -2109,8 +2116,8 @@
break; break;
case XSLT_OP_KEY: case XSLT_OP_KEY:
top = (xsltCompMatchPtr *) &(style->keyMatch); top = &(style->keyMatch);
break; break;
case XSLT_OP_ID: case XSLT_OP_ID:
/* TODO optimize ID !!! */ /* TODO optimize ID !!! */
case XSLT_OP_NS: case XSLT_OP_NS:
case XSLT_OP_ALL: case XSLT_OP_ALL:
...@@ -2112,9 +2119,9 @@ ...@@ -2112,9 +2119,9 @@
break; break;
case XSLT_OP_ID: case XSLT_OP_ID:
/* TODO optimize ID !!! */ /* TODO optimize ID !!! */
case XSLT_OP_NS: case XSLT_OP_NS:
case XSLT_OP_ALL: case XSLT_OP_ALL:
top = (xsltCompMatchPtr *) &(style->elemMatch); top = &(style->elemMatch);
break; break;
case XSLT_OP_END: case XSLT_OP_END:
case XSLT_OP_PREDICATE: case XSLT_OP_PREDICATE:
...@@ -2130,6 +2137,6 @@ ...@@ -2130,6 +2137,6 @@
if (pat->steps[0].value != NULL) if (pat->steps[0].value != NULL)
name = pat->steps[0].value; name = pat->steps[0].value;
else else
top = (xsltCompMatchPtr *) &(style->piMatch); top = &(style->piMatch);
break; break;
case XSLT_OP_COMMENT: case XSLT_OP_COMMENT:
...@@ -2134,5 +2141,5 @@ ...@@ -2134,5 +2141,5 @@
break; break;
case XSLT_OP_COMMENT: case XSLT_OP_COMMENT:
top = (xsltCompMatchPtr *) &(style->commentMatch); top = &(style->commentMatch);
break; break;
case XSLT_OP_TEXT: case XSLT_OP_TEXT:
...@@ -2137,9 +2144,9 @@ ...@@ -2137,9 +2144,9 @@
break; break;
case XSLT_OP_TEXT: case XSLT_OP_TEXT:
top = (xsltCompMatchPtr *) &(style->textMatch); top = &(style->textMatch);
break; break;
case XSLT_OP_ELEM: case XSLT_OP_ELEM:
case XSLT_OP_NODE: case XSLT_OP_NODE:
if (pat->steps[0].value != NULL) if (pat->steps[0].value != NULL)
name = pat->steps[0].value; name = pat->steps[0].value;
else else
...@@ -2140,10 +2147,10 @@ ...@@ -2140,10 +2147,10 @@
break; break;
case XSLT_OP_ELEM: case XSLT_OP_ELEM:
case XSLT_OP_NODE: case XSLT_OP_NODE:
if (pat->steps[0].value != NULL) if (pat->steps[0].value != NULL)
name = pat->steps[0].value; name = pat->steps[0].value;
else else
top = (xsltCompMatchPtr *) &(style->elemMatch); top = &(style->elemMatch);
break; break;
} }
if (name != NULL) { if (name != NULL) {
......
...@@ -2102,6 +2102,8 @@ ...@@ -2102,6 +2102,8 @@
#else #else
xpathCtxt = xmlXPathNewContext(style->doc); xpathCtxt = xmlXPathNewContext(style->doc);
#endif #endif
if (xpathCtxt == NULL)
return NULL;
xpathCtxt->dict = style->dict; xpathCtxt->dict = style->dict;
} else { } else {
xpathCtxt = xmlXPathNewContext(NULL); xpathCtxt = xmlXPathNewContext(NULL);
...@@ -2105,6 +2107,8 @@ ...@@ -2105,6 +2107,8 @@
xpathCtxt->dict = style->dict; xpathCtxt->dict = style->dict;
} else { } else {
xpathCtxt = xmlXPathNewContext(NULL); xpathCtxt = xmlXPathNewContext(NULL);
if (xpathCtxt == NULL)
return NULL;
} }
/* /*
* Compile the expression. * Compile the expression.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment