nokogiri 1.7.0.1-java → 1.7.1-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/Manifest.txt +3 -0
- data/dependencies.yml +2 -2
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/patches/libxml2/0001-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch +34 -0
- data/patches/libxml2/0002-Fix-XPointer-paths-beginning-with-range-to.patch +174 -0
- data/patches/libxml2/0003-Disallow-namespace-nodes-in-XPointer-ranges.patch +249 -0
- data/test/xml/test_node.rb +2 -1
- data/test/xml/test_xpath.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf8a0f095192347d51dbfb4db3289356d32403e0
|
4
|
+
data.tar.gz: e3e39fd2bc72162f7fe2a6232a8476deccb75eb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8187c2174d646092d20eedfd5e14b6fe9d903a215dab65e18b3a4e756a6f02d6d2eeb26842cf093fe8fca18b652661454519bf8716c1b09319a6c24d453a95c3
|
7
|
+
data.tar.gz: 456d7d59effe8c11e240d59b840e12087771f5b8e86b850b0b4eb9d9af3bdbfc10b743c4c3f6fa141e79b801095463fe56e2408654049d302f53c1a4f0d5ae6e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# 1.7.1 / unreleased
|
2
|
+
|
3
|
+
## Security Notes
|
4
|
+
|
5
|
+
[MRI] Upstream libxml2 patches are applied to the vendored libxml 2.9.4 which address CVE-2016-4658 and CVE-2016-5131.
|
6
|
+
|
7
|
+
For more information:
|
8
|
+
|
9
|
+
* https://github.com/sparklemotion/nokogiri/issues/1615
|
10
|
+
* http://people.canonical.com/~ubuntu-security/cve/2016/CVE-2016-4658.html
|
11
|
+
* http://people.canonical.com/~ubuntu-security/cve/2016/CVE-2016-5131.html
|
12
|
+
|
13
|
+
|
14
|
+
## Dependencies
|
15
|
+
|
16
|
+
* [Windows] Upgrade zlib from 1.2.8 to 1.2.11 (unless --use-system-libraries)
|
17
|
+
|
18
|
+
|
1
19
|
# 1.7.0.1 / 2017-01-04
|
2
20
|
|
3
21
|
## Bugs
|
data/Manifest.txt
CHANGED
@@ -246,6 +246,9 @@ lib/xalan.jar
|
|
246
246
|
lib/xercesImpl.jar
|
247
247
|
lib/xml-apis.jar
|
248
248
|
lib/xsd/xmlparser/nokogiri.rb
|
249
|
+
patches/libxml2/0001-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch
|
250
|
+
patches/libxml2/0002-Fix-XPointer-paths-beginning-with-range-to.patch
|
251
|
+
patches/libxml2/0003-Disallow-namespace-nodes-in-XPointer-ranges.patch
|
249
252
|
patches/sort-patches-by-date
|
250
253
|
suppressions/README.txt
|
251
254
|
suppressions/nokogiri_ree-1.8.7.358.supp
|
data/dependencies.yml
CHANGED
@@ -19,8 +19,8 @@ libxslt:
|
|
19
19
|
# Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
|
20
20
|
|
21
21
|
zlib:
|
22
|
-
version: "1.2.
|
23
|
-
md5: "
|
22
|
+
version: "1.2.11"
|
23
|
+
md5: "1c9f62f0778697a09d36121ead88e08e"
|
24
24
|
|
25
25
|
libiconv:
|
26
26
|
version: "1.14"
|
data/lib/nokogiri/nokogiri.jar
CHANGED
Binary file
|
data/lib/nokogiri/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
From a005199330b86dada19d162cae15ef9bdcb6baa8 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Tue, 28 Jun 2016 14:19:58 +0200
|
4
|
+
Subject: [PATCH] Fix comparison with root node in xmlXPathCmpNodes
|
5
|
+
|
6
|
+
This change has already been made in xmlXPathCmpNodesExt but not in
|
7
|
+
xmlXPathCmpNodes.
|
8
|
+
---
|
9
|
+
xpath.c | 4 ++--
|
10
|
+
1 file changed, 2 insertions(+), 2 deletions(-)
|
11
|
+
|
12
|
+
diff --git a/xpath.c b/xpath.c
|
13
|
+
index 751665b..d992841 100644
|
14
|
+
--- a/xpath.c
|
15
|
+
+++ b/xpath.c
|
16
|
+
@@ -3342,13 +3342,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
|
17
|
+
* compute depth to root
|
18
|
+
*/
|
19
|
+
for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
|
20
|
+
- if (cur == node1)
|
21
|
+
+ if (cur->parent == node1)
|
22
|
+
return(1);
|
23
|
+
depth2++;
|
24
|
+
}
|
25
|
+
root = cur;
|
26
|
+
for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
|
27
|
+
- if (cur == node2)
|
28
|
+
+ if (cur->parent == node2)
|
29
|
+
return(-1);
|
30
|
+
depth1++;
|
31
|
+
}
|
32
|
+
--
|
33
|
+
2.9.3
|
34
|
+
|
@@ -0,0 +1,174 @@
|
|
1
|
+
From 9ab01a277d71f54d3143c2cf333c5c2e9aaedd9e Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Tue, 28 Jun 2016 14:22:23 +0200
|
4
|
+
Subject: [PATCH] Fix XPointer paths beginning with range-to
|
5
|
+
|
6
|
+
The old code would invoke the broken xmlXPtrRangeToFunction. range-to
|
7
|
+
isn't really a function but a special kind of location step. Remove
|
8
|
+
this function and always handle range-to in the XPath code.
|
9
|
+
|
10
|
+
The old xmlXPtrRangeToFunction could also be abused to trigger a
|
11
|
+
use-after-free error with the potential for remote code execution.
|
12
|
+
|
13
|
+
Found with afl-fuzz.
|
14
|
+
|
15
|
+
Fixes CVE-2016-5131.
|
16
|
+
---
|
17
|
+
result/XPath/xptr/vidbase | 13 ++++++++
|
18
|
+
test/XPath/xptr/vidbase | 1 +
|
19
|
+
xpath.c | 7 ++++-
|
20
|
+
xpointer.c | 76 ++++-------------------------------------------
|
21
|
+
4 files changed, 26 insertions(+), 71 deletions(-)
|
22
|
+
|
23
|
+
diff --git a/result/XPath/xptr/vidbase b/result/XPath/xptr/vidbase
|
24
|
+
index 8b9e92d..f19193e 100644
|
25
|
+
--- a/result/XPath/xptr/vidbase
|
26
|
+
+++ b/result/XPath/xptr/vidbase
|
27
|
+
@@ -17,3 +17,16 @@ Object is a Location Set:
|
28
|
+
To node
|
29
|
+
ELEMENT p
|
30
|
+
|
31
|
+
+
|
32
|
+
+========================
|
33
|
+
+Expression: xpointer(range-to(id('chapter2')))
|
34
|
+
+Object is a Location Set:
|
35
|
+
+1 : Object is a range :
|
36
|
+
+ From node
|
37
|
+
+ /
|
38
|
+
+ To node
|
39
|
+
+ ELEMENT chapter
|
40
|
+
+ ATTRIBUTE id
|
41
|
+
+ TEXT
|
42
|
+
+ content=chapter2
|
43
|
+
+
|
44
|
+
diff --git a/test/XPath/xptr/vidbase b/test/XPath/xptr/vidbase
|
45
|
+
index b146383..884b106 100644
|
46
|
+
--- a/test/XPath/xptr/vidbase
|
47
|
+
+++ b/test/XPath/xptr/vidbase
|
48
|
+
@@ -1,2 +1,3 @@
|
49
|
+
xpointer(id('chapter1')/p)
|
50
|
+
xpointer(id('chapter1')/p[1]/range-to(following-sibling::p[2]))
|
51
|
+
+xpointer(range-to(id('chapter2')))
|
52
|
+
diff --git a/xpath.c b/xpath.c
|
53
|
+
index d992841..5a01b1b 100644
|
54
|
+
--- a/xpath.c
|
55
|
+
+++ b/xpath.c
|
56
|
+
@@ -10691,13 +10691,18 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) {
|
57
|
+
lc = 1;
|
58
|
+
break;
|
59
|
+
} else if ((NXT(len) == '(')) {
|
60
|
+
- /* Note Type or Function */
|
61
|
+
+ /* Node Type or Function */
|
62
|
+
if (xmlXPathIsNodeType(name)) {
|
63
|
+
#ifdef DEBUG_STEP
|
64
|
+
xmlGenericError(xmlGenericErrorContext,
|
65
|
+
"PathExpr: Type search\n");
|
66
|
+
#endif
|
67
|
+
lc = 1;
|
68
|
+
+#ifdef LIBXML_XPTR_ENABLED
|
69
|
+
+ } else if (ctxt->xptr &&
|
70
|
+
+ xmlStrEqual(name, BAD_CAST "range-to")) {
|
71
|
+
+ lc = 1;
|
72
|
+
+#endif
|
73
|
+
} else {
|
74
|
+
#ifdef DEBUG_STEP
|
75
|
+
xmlGenericError(xmlGenericErrorContext,
|
76
|
+
diff --git a/xpointer.c b/xpointer.c
|
77
|
+
index 676c510..d74174a 100644
|
78
|
+
--- a/xpointer.c
|
79
|
+
+++ b/xpointer.c
|
80
|
+
@@ -1332,8 +1332,6 @@ xmlXPtrNewContext(xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin) {
|
81
|
+
ret->here = here;
|
82
|
+
ret->origin = origin;
|
83
|
+
|
84
|
+
- xmlXPathRegisterFunc(ret, (xmlChar *)"range-to",
|
85
|
+
- xmlXPtrRangeToFunction);
|
86
|
+
xmlXPathRegisterFunc(ret, (xmlChar *)"range",
|
87
|
+
xmlXPtrRangeFunction);
|
88
|
+
xmlXPathRegisterFunc(ret, (xmlChar *)"range-inside",
|
89
|
+
@@ -2243,76 +2241,14 @@ xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
90
|
+
* @nargs: the number of args
|
91
|
+
*
|
92
|
+
* Implement the range-to() XPointer function
|
93
|
+
+ *
|
94
|
+
+ * Obsolete. range-to is not a real function but a special type of location
|
95
|
+
+ * step which is handled in xpath.c.
|
96
|
+
*/
|
97
|
+
void
|
98
|
+
-xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
99
|
+
- xmlXPathObjectPtr range;
|
100
|
+
- const xmlChar *cur;
|
101
|
+
- xmlXPathObjectPtr res, obj;
|
102
|
+
- xmlXPathObjectPtr tmp;
|
103
|
+
- xmlLocationSetPtr newset = NULL;
|
104
|
+
- xmlNodeSetPtr oldset;
|
105
|
+
- int i;
|
106
|
+
-
|
107
|
+
- if (ctxt == NULL) return;
|
108
|
+
- CHECK_ARITY(1);
|
109
|
+
- /*
|
110
|
+
- * Save the expression pointer since we will have to evaluate
|
111
|
+
- * it multiple times. Initialize the new set.
|
112
|
+
- */
|
113
|
+
- CHECK_TYPE(XPATH_NODESET);
|
114
|
+
- obj = valuePop(ctxt);
|
115
|
+
- oldset = obj->nodesetval;
|
116
|
+
- ctxt->context->node = NULL;
|
117
|
+
-
|
118
|
+
- cur = ctxt->cur;
|
119
|
+
- newset = xmlXPtrLocationSetCreate(NULL);
|
120
|
+
-
|
121
|
+
- for (i = 0; i < oldset->nodeNr; i++) {
|
122
|
+
- ctxt->cur = cur;
|
123
|
+
-
|
124
|
+
- /*
|
125
|
+
- * Run the evaluation with a node list made of a single item
|
126
|
+
- * in the nodeset.
|
127
|
+
- */
|
128
|
+
- ctxt->context->node = oldset->nodeTab[i];
|
129
|
+
- tmp = xmlXPathNewNodeSet(ctxt->context->node);
|
130
|
+
- valuePush(ctxt, tmp);
|
131
|
+
-
|
132
|
+
- xmlXPathEvalExpr(ctxt);
|
133
|
+
- CHECK_ERROR;
|
134
|
+
-
|
135
|
+
- /*
|
136
|
+
- * The result of the evaluation need to be tested to
|
137
|
+
- * decided whether the filter succeeded or not
|
138
|
+
- */
|
139
|
+
- res = valuePop(ctxt);
|
140
|
+
- range = xmlXPtrNewRangeNodeObject(oldset->nodeTab[i], res);
|
141
|
+
- if (range != NULL) {
|
142
|
+
- xmlXPtrLocationSetAdd(newset, range);
|
143
|
+
- }
|
144
|
+
-
|
145
|
+
- /*
|
146
|
+
- * Cleanup
|
147
|
+
- */
|
148
|
+
- if (res != NULL)
|
149
|
+
- xmlXPathFreeObject(res);
|
150
|
+
- if (ctxt->value == tmp) {
|
151
|
+
- res = valuePop(ctxt);
|
152
|
+
- xmlXPathFreeObject(res);
|
153
|
+
- }
|
154
|
+
-
|
155
|
+
- ctxt->context->node = NULL;
|
156
|
+
- }
|
157
|
+
-
|
158
|
+
- /*
|
159
|
+
- * The result is used as the new evaluation set.
|
160
|
+
- */
|
161
|
+
- xmlXPathFreeObject(obj);
|
162
|
+
- ctxt->context->node = NULL;
|
163
|
+
- ctxt->context->contextSize = -1;
|
164
|
+
- ctxt->context->proximityPosition = -1;
|
165
|
+
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
|
166
|
+
+xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt,
|
167
|
+
+ int nargs ATTRIBUTE_UNUSED) {
|
168
|
+
+ XP_ERROR(XPATH_EXPR_ERROR);
|
169
|
+
}
|
170
|
+
|
171
|
+
/**
|
172
|
+
--
|
173
|
+
2.9.3
|
174
|
+
|
@@ -0,0 +1,249 @@
|
|
1
|
+
From c1d1f7121194036608bf555f08d3062a36fd344b Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Tue, 28 Jun 2016 18:34:52 +0200
|
4
|
+
Subject: [PATCH] Disallow namespace nodes in XPointer ranges
|
5
|
+
|
6
|
+
Namespace nodes must be copied to avoid use-after-free errors.
|
7
|
+
But they don't necessarily have a physical representation in a
|
8
|
+
document, so simply disallow them in XPointer ranges.
|
9
|
+
|
10
|
+
Found with afl-fuzz.
|
11
|
+
|
12
|
+
Fixes CVE-2016-4658.
|
13
|
+
---
|
14
|
+
xpointer.c | 149 +++++++++++++++++++++++--------------------------------------
|
15
|
+
1 file changed, 56 insertions(+), 93 deletions(-)
|
16
|
+
|
17
|
+
diff --git a/xpointer.c b/xpointer.c
|
18
|
+
index a7b03fb..694d120 100644
|
19
|
+
--- a/xpointer.c
|
20
|
+
+++ b/xpointer.c
|
21
|
+
@@ -319,6 +319,45 @@ xmlXPtrRangesEqual(xmlXPathObjectPtr range1, xmlXPathObjectPtr range2) {
|
22
|
+
return(1);
|
23
|
+
}
|
24
|
+
|
25
|
+
+/**
|
26
|
+
+ * xmlXPtrNewRangeInternal:
|
27
|
+
+ * @start: the starting node
|
28
|
+
+ * @startindex: the start index
|
29
|
+
+ * @end: the ending point
|
30
|
+
+ * @endindex: the ending index
|
31
|
+
+ *
|
32
|
+
+ * Internal function to create a new xmlXPathObjectPtr of type range
|
33
|
+
+ *
|
34
|
+
+ * Returns the newly created object.
|
35
|
+
+ */
|
36
|
+
+static xmlXPathObjectPtr
|
37
|
+
+xmlXPtrNewRangeInternal(xmlNodePtr start, int startindex,
|
38
|
+
+ xmlNodePtr end, int endindex) {
|
39
|
+
+ xmlXPathObjectPtr ret;
|
40
|
+
+
|
41
|
+
+ /*
|
42
|
+
+ * Namespace nodes must be copied (see xmlXPathNodeSetDupNs).
|
43
|
+
+ * Disallow them for now.
|
44
|
+
+ */
|
45
|
+
+ if ((start != NULL) && (start->type == XML_NAMESPACE_DECL))
|
46
|
+
+ return(NULL);
|
47
|
+
+ if ((end != NULL) && (end->type == XML_NAMESPACE_DECL))
|
48
|
+
+ return(NULL);
|
49
|
+
+
|
50
|
+
+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
51
|
+
+ if (ret == NULL) {
|
52
|
+
+ xmlXPtrErrMemory("allocating range");
|
53
|
+
+ return(NULL);
|
54
|
+
+ }
|
55
|
+
+ memset(ret, 0, sizeof(xmlXPathObject));
|
56
|
+
+ ret->type = XPATH_RANGE;
|
57
|
+
+ ret->user = start;
|
58
|
+
+ ret->index = startindex;
|
59
|
+
+ ret->user2 = end;
|
60
|
+
+ ret->index2 = endindex;
|
61
|
+
+ return(ret);
|
62
|
+
+}
|
63
|
+
+
|
64
|
+
/**
|
65
|
+
* xmlXPtrNewRange:
|
66
|
+
* @start: the starting node
|
67
|
+
@@ -344,17 +383,7 @@ xmlXPtrNewRange(xmlNodePtr start, int startindex,
|
68
|
+
if (endindex < 0)
|
69
|
+
return(NULL);
|
70
|
+
|
71
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
72
|
+
- if (ret == NULL) {
|
73
|
+
- xmlXPtrErrMemory("allocating range");
|
74
|
+
- return(NULL);
|
75
|
+
- }
|
76
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
77
|
+
- ret->type = XPATH_RANGE;
|
78
|
+
- ret->user = start;
|
79
|
+
- ret->index = startindex;
|
80
|
+
- ret->user2 = end;
|
81
|
+
- ret->index2 = endindex;
|
82
|
+
+ ret = xmlXPtrNewRangeInternal(start, startindex, end, endindex);
|
83
|
+
xmlXPtrRangeCheckOrder(ret);
|
84
|
+
return(ret);
|
85
|
+
}
|
86
|
+
@@ -381,17 +410,8 @@ xmlXPtrNewRangePoints(xmlXPathObjectPtr start, xmlXPathObjectPtr end) {
|
87
|
+
if (end->type != XPATH_POINT)
|
88
|
+
return(NULL);
|
89
|
+
|
90
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
91
|
+
- if (ret == NULL) {
|
92
|
+
- xmlXPtrErrMemory("allocating range");
|
93
|
+
- return(NULL);
|
94
|
+
- }
|
95
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
96
|
+
- ret->type = XPATH_RANGE;
|
97
|
+
- ret->user = start->user;
|
98
|
+
- ret->index = start->index;
|
99
|
+
- ret->user2 = end->user;
|
100
|
+
- ret->index2 = end->index;
|
101
|
+
+ ret = xmlXPtrNewRangeInternal(start->user, start->index, end->user,
|
102
|
+
+ end->index);
|
103
|
+
xmlXPtrRangeCheckOrder(ret);
|
104
|
+
return(ret);
|
105
|
+
}
|
106
|
+
@@ -416,17 +436,7 @@ xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, xmlNodePtr end) {
|
107
|
+
if (start->type != XPATH_POINT)
|
108
|
+
return(NULL);
|
109
|
+
|
110
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
111
|
+
- if (ret == NULL) {
|
112
|
+
- xmlXPtrErrMemory("allocating range");
|
113
|
+
- return(NULL);
|
114
|
+
- }
|
115
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
116
|
+
- ret->type = XPATH_RANGE;
|
117
|
+
- ret->user = start->user;
|
118
|
+
- ret->index = start->index;
|
119
|
+
- ret->user2 = end;
|
120
|
+
- ret->index2 = -1;
|
121
|
+
+ ret = xmlXPtrNewRangeInternal(start->user, start->index, end, -1);
|
122
|
+
xmlXPtrRangeCheckOrder(ret);
|
123
|
+
return(ret);
|
124
|
+
}
|
125
|
+
@@ -453,17 +463,7 @@ xmlXPtrNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) {
|
126
|
+
if (end->type != XPATH_POINT)
|
127
|
+
return(NULL);
|
128
|
+
|
129
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
130
|
+
- if (ret == NULL) {
|
131
|
+
- xmlXPtrErrMemory("allocating range");
|
132
|
+
- return(NULL);
|
133
|
+
- }
|
134
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
135
|
+
- ret->type = XPATH_RANGE;
|
136
|
+
- ret->user = start;
|
137
|
+
- ret->index = -1;
|
138
|
+
- ret->user2 = end->user;
|
139
|
+
- ret->index2 = end->index;
|
140
|
+
+ ret = xmlXPtrNewRangeInternal(start, -1, end->user, end->index);
|
141
|
+
xmlXPtrRangeCheckOrder(ret);
|
142
|
+
return(ret);
|
143
|
+
}
|
144
|
+
@@ -486,17 +486,7 @@ xmlXPtrNewRangeNodes(xmlNodePtr start, xmlNodePtr end) {
|
145
|
+
if (end == NULL)
|
146
|
+
return(NULL);
|
147
|
+
|
148
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
149
|
+
- if (ret == NULL) {
|
150
|
+
- xmlXPtrErrMemory("allocating range");
|
151
|
+
- return(NULL);
|
152
|
+
- }
|
153
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
154
|
+
- ret->type = XPATH_RANGE;
|
155
|
+
- ret->user = start;
|
156
|
+
- ret->index = -1;
|
157
|
+
- ret->user2 = end;
|
158
|
+
- ret->index2 = -1;
|
159
|
+
+ ret = xmlXPtrNewRangeInternal(start, -1, end, -1);
|
160
|
+
xmlXPtrRangeCheckOrder(ret);
|
161
|
+
return(ret);
|
162
|
+
}
|
163
|
+
@@ -516,17 +506,7 @@ xmlXPtrNewCollapsedRange(xmlNodePtr start) {
|
164
|
+
if (start == NULL)
|
165
|
+
return(NULL);
|
166
|
+
|
167
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
168
|
+
- if (ret == NULL) {
|
169
|
+
- xmlXPtrErrMemory("allocating range");
|
170
|
+
- return(NULL);
|
171
|
+
- }
|
172
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
173
|
+
- ret->type = XPATH_RANGE;
|
174
|
+
- ret->user = start;
|
175
|
+
- ret->index = -1;
|
176
|
+
- ret->user2 = NULL;
|
177
|
+
- ret->index2 = -1;
|
178
|
+
+ ret = xmlXPtrNewRangeInternal(start, -1, NULL, -1);
|
179
|
+
return(ret);
|
180
|
+
}
|
181
|
+
|
182
|
+
@@ -541,6 +521,8 @@ xmlXPtrNewCollapsedRange(xmlNodePtr start) {
|
183
|
+
*/
|
184
|
+
xmlXPathObjectPtr
|
185
|
+
xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
|
186
|
+
+ xmlNodePtr endNode;
|
187
|
+
+ int endIndex;
|
188
|
+
xmlXPathObjectPtr ret;
|
189
|
+
|
190
|
+
if (start == NULL)
|
191
|
+
@@ -549,7 +531,12 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
|
192
|
+
return(NULL);
|
193
|
+
switch (end->type) {
|
194
|
+
case XPATH_POINT:
|
195
|
+
+ endNode = end->user;
|
196
|
+
+ endIndex = end->index;
|
197
|
+
+ break;
|
198
|
+
case XPATH_RANGE:
|
199
|
+
+ endNode = end->user2;
|
200
|
+
+ endIndex = end->index2;
|
201
|
+
break;
|
202
|
+
case XPATH_NODESET:
|
203
|
+
/*
|
204
|
+
@@ -557,39 +544,15 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
|
205
|
+
*/
|
206
|
+
if (end->nodesetval->nodeNr <= 0)
|
207
|
+
return(NULL);
|
208
|
+
+ endNode = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
|
209
|
+
+ endIndex = -1;
|
210
|
+
break;
|
211
|
+
default:
|
212
|
+
/* TODO */
|
213
|
+
return(NULL);
|
214
|
+
}
|
215
|
+
|
216
|
+
- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
|
217
|
+
- if (ret == NULL) {
|
218
|
+
- xmlXPtrErrMemory("allocating range");
|
219
|
+
- return(NULL);
|
220
|
+
- }
|
221
|
+
- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
|
222
|
+
- ret->type = XPATH_RANGE;
|
223
|
+
- ret->user = start;
|
224
|
+
- ret->index = -1;
|
225
|
+
- switch (end->type) {
|
226
|
+
- case XPATH_POINT:
|
227
|
+
- ret->user2 = end->user;
|
228
|
+
- ret->index2 = end->index;
|
229
|
+
- break;
|
230
|
+
- case XPATH_RANGE:
|
231
|
+
- ret->user2 = end->user2;
|
232
|
+
- ret->index2 = end->index2;
|
233
|
+
- break;
|
234
|
+
- case XPATH_NODESET: {
|
235
|
+
- ret->user2 = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
|
236
|
+
- ret->index2 = -1;
|
237
|
+
- break;
|
238
|
+
- }
|
239
|
+
- default:
|
240
|
+
- STRANGE
|
241
|
+
- return(NULL);
|
242
|
+
- }
|
243
|
+
+ ret = xmlXPtrNewRangeInternal(start, -1, endNode, endIndex);
|
244
|
+
xmlXPtrRangeCheckOrder(ret);
|
245
|
+
return(ret);
|
246
|
+
}
|
247
|
+
--
|
248
|
+
2.9.3
|
249
|
+
|
data/test/xml/test_node.rb
CHANGED
@@ -326,8 +326,9 @@ module Nokogiri
|
|
326
326
|
end
|
327
327
|
|
328
328
|
def test_document_compare
|
329
|
+
skip "underlying libxml2 behavior changed in libxml2@a005199"
|
329
330
|
nodes = @xml.xpath('//employee')
|
330
|
-
assert_equal(-1, (nodes.first <=> @xml))
|
331
|
+
assert_equal(-1, (nodes.first <=> @xml)) # post-libxml2@a005199, returns 1
|
331
332
|
end
|
332
333
|
|
333
334
|
def test_different_document_compare
|
data/test/xml/test_xpath.rb
CHANGED
@@ -186,7 +186,7 @@ module Nokogiri
|
|
186
186
|
|
187
187
|
# issue #741 (xpath() around 10x slower in JRuby)
|
188
188
|
def test_slow_jruby_xpath
|
189
|
-
skip("
|
189
|
+
skip("testing against an absolute time is brittle. help make this better! see https://github.com/sparklemotion/nokogiri/issues/741")
|
190
190
|
|
191
191
|
doc = Nokogiri::XML(File.open(XPATH_FILE))
|
192
192
|
start = Time.now
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2017-
|
15
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +173,7 @@ dependencies:
|
|
173
173
|
requirements:
|
174
174
|
- - ~>
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version: '3.
|
176
|
+
version: '3.16'
|
177
177
|
name: hoe
|
178
178
|
prerelease: false
|
179
179
|
type: :development
|
@@ -181,7 +181,7 @@ dependencies:
|
|
181
181
|
requirements:
|
182
182
|
- - ~>
|
183
183
|
- !ruby/object:Gem::Version
|
184
|
-
version: '3.
|
184
|
+
version: '3.16'
|
185
185
|
description: |-
|
186
186
|
Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
|
187
187
|
Nokogiri's many features is the ability to search documents via XPath
|
@@ -490,6 +490,9 @@ files:
|
|
490
490
|
- lib/xercesImpl.jar
|
491
491
|
- lib/xml-apis.jar
|
492
492
|
- lib/xsd/xmlparser/nokogiri.rb
|
493
|
+
- patches/libxml2/0001-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch
|
494
|
+
- patches/libxml2/0002-Fix-XPointer-paths-beginning-with-range-to.patch
|
495
|
+
- patches/libxml2/0003-Disallow-namespace-nodes-in-XPointer-ranges.patch
|
493
496
|
- patches/sort-patches-by-date
|
494
497
|
- suppressions/README.txt
|
495
498
|
- suppressions/nokogiri_ree-1.8.7.358.supp
|