mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
fix bug #107804, the algorithm used for document order computation was
* xpath.c: fix bug #107804, the algorithm used for document order computation was failing on attributes. Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Fri Mar 7 15:18:32 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xpath.c: fix bug #107804, the algorithm used for document order
|
||||||
|
computation was failing on attributes.
|
||||||
|
|
||||||
Thu Mar 6 22:35:50 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Thu Mar 6 22:35:50 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* valid.c: fix bug #107764 , possibility of buffer overflow
|
* valid.c: fix bug #107764 , possibility of buffer overflow
|
||||||
|
18
xpath.c
18
xpath.c
@ -1352,6 +1352,7 @@ xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file ATTRIBUTE_UNUSED,
|
|||||||
int
|
int
|
||||||
xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
|
xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
|
||||||
int depth1, depth2;
|
int depth1, depth2;
|
||||||
|
int attr1 = 0, attr2 = 0;
|
||||||
xmlNodePtr cur, root;
|
xmlNodePtr cur, root;
|
||||||
|
|
||||||
if ((node1 == NULL) || (node2 == NULL))
|
if ((node1 == NULL) || (node2 == NULL))
|
||||||
@ -1359,8 +1360,21 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
|
|||||||
/*
|
/*
|
||||||
* a couple of optimizations which will avoid computations in most cases
|
* a couple of optimizations which will avoid computations in most cases
|
||||||
*/
|
*/
|
||||||
if (node1 == node2)
|
if (node1->type == XML_ATTRIBUTE_NODE) {
|
||||||
return(0);
|
attr1 = 1;
|
||||||
|
node1 = node1->parent;
|
||||||
|
}
|
||||||
|
if (node2->type == XML_ATTRIBUTE_NODE) {
|
||||||
|
attr2 = 1;
|
||||||
|
node2 = node2->parent;
|
||||||
|
}
|
||||||
|
if (node1 == node2) {
|
||||||
|
if (attr1 == attr2)
|
||||||
|
return(0);
|
||||||
|
if (attr2 == 1)
|
||||||
|
return(1);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
if ((node1->type == XML_NAMESPACE_DECL) ||
|
if ((node1->type == XML_NAMESPACE_DECL) ||
|
||||||
(node2->type == XML_NAMESPACE_DECL))
|
(node2->type == XML_NAMESPACE_DECL))
|
||||||
return(1);
|
return(1);
|
||||||
|
Reference in New Issue
Block a user