mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
applied fix from Mathias Hasselmann about a bug in URI parsing. fix bug
* uri.c: applied fix from Mathias Hasselmann about a bug in URI parsing. * xpath.c: fix bug #61291 the default XML namespace node is missing from the namespace axis. * tree.c: refuse to create namespaces nodes with prefix "xml" Daniel
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
Fri Oct 5 11:16:21 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* uri.c: applied fix from Mathias Hasselmann about a bug in URI
|
||||||
|
parsing.
|
||||||
|
* xpath.c: fix bug #61291 the default XML namespace node is
|
||||||
|
missing from the namespace axis.
|
||||||
|
* tree.c: refuse to create namespaces nodes with prefix "xml"
|
||||||
|
|
||||||
Thu Oct 4 16:47:44 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
Thu Oct 4 16:47:44 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* SAX.c: ouch a non-defined namespace could lead to a crash,
|
* SAX.c: ouch a non-defined namespace could lead to a crash,
|
||||||
|
3
tree.c
3
tree.c
@ -132,6 +132,9 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
|
|||||||
if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
|
if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
|
if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xml")))
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a new Namespace and fill the fields.
|
* Allocate a new Namespace and fill the fields.
|
||||||
*/
|
*/
|
||||||
|
7
uri.c
7
uri.c
@ -1649,14 +1649,19 @@ xmlParseURIHierPart(xmlURIPtr uri, const char **str) {
|
|||||||
static int
|
static int
|
||||||
xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) {
|
xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) {
|
||||||
int ret;
|
int ret;
|
||||||
|
const char *cur;
|
||||||
|
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
|
cur = *str;
|
||||||
|
|
||||||
ret = xmlParseURIScheme(uri, str);
|
ret = xmlParseURIScheme(uri, str);
|
||||||
if (ret != 0) return(ret);
|
if (ret != 0) return(ret);
|
||||||
if (**str != ':')
|
if (**str != ':') {
|
||||||
|
*str = cur;
|
||||||
return(1);
|
return(1);
|
||||||
|
}
|
||||||
(*str)++;
|
(*str)++;
|
||||||
if (**str == '/')
|
if (**str == '/')
|
||||||
return(xmlParseURIHierPart(uri, str));
|
return(xmlParseURIHierPart(uri, str));
|
||||||
|
20
xpath.c
20
xpath.c
@ -62,6 +62,14 @@ void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|||||||
double xmlXPathStringEvalNumber(const xmlChar *str);
|
double xmlXPathStringEvalNumber(const xmlChar *str);
|
||||||
double xmlXPathDivideBy(double f, double fzero);
|
double xmlXPathDivideBy(double f, double fzero);
|
||||||
|
|
||||||
|
static xmlNs xmlXPathXMLNamespaceStruct = {
|
||||||
|
NULL,
|
||||||
|
XML_NAMESPACE_DECL,
|
||||||
|
XML_XML_NAMESPACE,
|
||||||
|
BAD_CAST "xml"
|
||||||
|
};
|
||||||
|
static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Floating point stuff *
|
* Floating point stuff *
|
||||||
@ -79,6 +87,7 @@ double xmlXPathDivideBy(double f, double fzero);
|
|||||||
double xmlXPathNAN = 0;
|
double xmlXPathNAN = 0;
|
||||||
double xmlXPathPINF = 1;
|
double xmlXPathPINF = 1;
|
||||||
double xmlXPathNINF = -1;
|
double xmlXPathNINF = -1;
|
||||||
|
static int xmlXPathInitialized = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlXPathInit:
|
* xmlXPathInit:
|
||||||
@ -87,15 +96,13 @@ double xmlXPathNINF = -1;
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlXPathInit(void) {
|
xmlXPathInit(void) {
|
||||||
static int initialized = 0;
|
if (xmlXPathInitialized) return;
|
||||||
|
|
||||||
if (initialized) return;
|
|
||||||
|
|
||||||
xmlXPathPINF = trio_pinf();
|
xmlXPathPINF = trio_pinf();
|
||||||
xmlXPathNINF = trio_ninf();
|
xmlXPathNINF = trio_ninf();
|
||||||
xmlXPathNAN = trio_nan();
|
xmlXPathNAN = trio_nan();
|
||||||
|
|
||||||
initialized = 1;
|
xmlXPathInitialized = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4970,6 +4977,8 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
|
|||||||
* the order of nodes on this axis is implementation-defined; the axis will
|
* the order of nodes on this axis is implementation-defined; the axis will
|
||||||
* be empty unless the context node is an element
|
* be empty unless the context node is an element
|
||||||
*
|
*
|
||||||
|
* We keep the XML namespace node at the end of the list.
|
||||||
|
*
|
||||||
* Returns the next element following that axis
|
* Returns the next element following that axis
|
||||||
*/
|
*/
|
||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
@ -4977,6 +4986,8 @@ xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
xmlNodePtr ret;
|
xmlNodePtr ret;
|
||||||
|
|
||||||
if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
|
if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
|
||||||
|
if (cur == (xmlNodePtr) xmlXPathXMLNamespace)
|
||||||
|
return(NULL);
|
||||||
if ((cur == NULL) || (ctxt->context->tmpNsList == NULL)) {
|
if ((cur == NULL) || (ctxt->context->tmpNsList == NULL)) {
|
||||||
if (ctxt->context->tmpNsList != NULL)
|
if (ctxt->context->tmpNsList != NULL)
|
||||||
xmlFree(ctxt->context->tmpNsList);
|
xmlFree(ctxt->context->tmpNsList);
|
||||||
@ -4989,6 +5000,7 @@ xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
xmlFree(ctxt->context->tmpNsList);
|
xmlFree(ctxt->context->tmpNsList);
|
||||||
ctxt->context->tmpNsList = NULL;
|
ctxt->context->tmpNsList = NULL;
|
||||||
|
return((xmlNodePtr) xmlXPathXMLNamespace);
|
||||||
}
|
}
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user