Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libxml2/files/, dev-libs/libxml2/
Date: Fri, 02 Mar 2018 16:09:31
Message-Id: 1520006930.783baf3271249d8e234cd806650191181ef03c9c.leio@gentoo
1 commit: 783baf3271249d8e234cd806650191181ef03c9c
2 Author: Mart Raudsepp <leio <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 2 14:32:11 2018 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 2 16:08:50 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=783baf32
7
8 dev-libs/libxml2: security cleanup
9
10 Bug: https://bugs.gentoo.org/644574
11 Package-Manager: Portage-2.3.19, Repoman-2.3.6
12
13 dev-libs/libxml2/Manifest | 1 -
14 .../files/libxml2-2.9.2-disable-tests.patch | 68 ------
15 .../files/libxml2-2.9.4-CVE-2016-4658.patch | 249 ---------------------
16 .../files/libxml2-2.9.4-CVE-2016-5131.patch | 174 --------------
17 .../libxml2/files/libxml2-2.9.4-nullptrderef.patch | 50 -----
18 .../files/libxml2-2.9.4-nullptrderef2.patch | 57 -----
19 dev-libs/libxml2/libxml2-2.9.4-r1.ebuild | 220 ------------------
20 7 files changed, 819 deletions(-)
21
22 diff --git a/dev-libs/libxml2/Manifest b/dev-libs/libxml2/Manifest
23 index a4a9a1eed8c..97855caaa55 100644
24 --- a/dev-libs/libxml2/Manifest
25 +++ b/dev-libs/libxml2/Manifest
26 @@ -1,4 +1,3 @@
27 -DIST libxml2-2.9.4.tar.gz 5374830 BLAKE2B eb0df2310a7a92084475ccd9bf538cc1c85861b2a8c766e91267b671c18eae3113016abd7bb198b6a239230cb2b9b908b9618fec11d36db10fd5cf6eac03ad3f SHA512 f5174ab1a3a0ec0037a47f47aa47def36674e02bfb42b57f609563f84c6247c585dbbb133c056953a5adb968d328f18cbc102eb0d00d48eb7c95478389e5daf9
28 DIST libxml2-2.9.6.tar.gz 5469624 BLAKE2B cb8fc74044876b2ddf9742a4a84d685ce6cd1e41a991ee79fd70a9175c54d2a9a3d3a2c3229a4ce177fcd4e30b0cee08c7cf3a36fef68b179db0ce521fbbf3b0 SHA512 5ef80f895374bd5dd3bcd5f00c715795f026bf45d998f8f762c0cdb739b8755e01de40cf853d98a3826eacef95c4adebe4777db11020e8d98d0bda921f55a0ed
29 DIST libxml2-2.9.7.tar.gz 5467389 BLAKE2B e15082fb87fb41a7aab6f39120b1d1bbd0325af8009bb3b74c69a98bf7347a39f59055762df157dcf223a79ac84f17535cb40af0a9a461ee3d2c1d55f4832e1b SHA512 da06cb7c5032ef4b7c8e902fabb9d2c74634c42c161be07a7c66a00d53a68029f89b0d4de32a6b9d4ff338c2d1d9c4e53aefb9cf50cb1c2d6c6b06b442ef42d5
30 DIST xmlts20080827.tar.gz 638940 BLAKE2B c5aab959c6e0698acd5b9be82b48a8ac26f4d01cc03f9acfff20d344f97f4711fc6d4a524ae70457147e8e30c72e27b6726829e1dd21896286aa974ed60774e7 SHA512 7325d0977c4427fc4944b291ccf896a665f654cc24399e5565c12a849c2bc3aef4fa3ee42a09ac115abcb6570c51a8fbd052c38d64d164279ecdecad5a4e884d
31
32 diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-disable-tests.patch b/dev-libs/libxml2/files/libxml2-2.9.2-disable-tests.patch
33 deleted file mode 100644
34 index a231269b4b8..00000000000
35 --- a/dev-libs/libxml2/files/libxml2-2.9.2-disable-tests.patch
36 +++ /dev/null
37 @@ -1,68 +0,0 @@
38 -do not build test programs as we don't install them
39 -
40 ---- a/Makefile.am
41 -+++ b/Makefile.am
42 -@@ -10,7 +10,7 @@
43 -
44 - AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
45 -
46 --noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
47 -+check_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
48 - testThreads testC14N testAutomata testRegexp \
49 - testReader testapi testModule runtest runsuite testchar \
50 - testdict runxmlconf testrecurse testlimits
51 -@@ -170,7 +170,7 @@
52 - testModule_DEPENDENCIES = $(DEPS)
53 - testModule_LDADD= $(LDADDS)
54 -
55 --noinst_LTLIBRARIES = testdso.la
56 -+check_LTLIBRARIES = testdso.la
57 - testdso_la_SOURCES = testdso.c
58 - testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
59 -
60 -@@ -202,7 +202,7 @@ runxmlconf_LDADD= $(LDADDS)
61 - #testOOM_DEPENDENCIES = $(DEPS)
62 - #testOOM_LDADD= $(LDADDS)
63 -
64 --runtests:
65 -+runtests: $(check_PROGRAMS)
66 - [ -d test ] || $(LN_S) $(srcdir)/test .
67 - [ -d result ] || $(LN_S) $(srcdir)/result .
68 - $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
69 ---- a/doc/examples/Makefile.am
70 -+++ b/doc/examples/Makefile.am
71 -@@ -13,7 +13,7 @@
72 - rebuild: examples.xml index.html
73 - .PHONY: rebuild
74 -
75 --examples.xml: index.py $(noinst_PROGRAMS:=.c)
76 -+examples.xml: index.py $(check_PROGRAMS:=.c)
77 - cd $(srcdir) && $(PYTHON) index.py
78 - $(MAKE) Makefile
79 -
80 -@@ -49,7 +49,7 @@
81 - xpath1.res \
82 - xpath2.res
83 -
84 --noinst_PROGRAMS = \
85 -+check_PROGRAMS = \
86 - io1 \
87 - io2 \
88 - parse1 \
89 -@@ -99,7 +99,7 @@
90 - valgrind:
91 - $(MAKE) CHECKER='valgrind' tests
92 -
93 --tests: $(noinst_PROGRAMS)
94 -+tests: $(check_PROGRAMS)
95 - test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .
96 - @(echo '## examples regression tests')
97 - @(echo > .memdump)
98 ---- a/example/Makefile.am
99 -+++ b/example/Makefile.am
100 -@@ -1,4 +1,4 @@
101 --noinst_PROGRAMS = gjobread
102 -+check_PROGRAMS = gjobread
103 -
104 - AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
105 - AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
106
107 diff --git a/dev-libs/libxml2/files/libxml2-2.9.4-CVE-2016-4658.patch b/dev-libs/libxml2/files/libxml2-2.9.4-CVE-2016-4658.patch
108 deleted file mode 100644
109 index 2ef22ce7a0d..00000000000
110 --- a/dev-libs/libxml2/files/libxml2-2.9.4-CVE-2016-4658.patch
111 +++ /dev/null
112 @@ -1,249 +0,0 @@
113 -From c1d1f7121194036608bf555f08d3062a36fd344b Mon Sep 17 00:00:00 2001
114 -From: Nick Wellnhofer <wellnhofer@×××××.de>
115 -Date: Tue, 28 Jun 2016 18:34:52 +0200
116 -Subject: Disallow namespace nodes in XPointer ranges
117 -
118 -Namespace nodes must be copied to avoid use-after-free errors.
119 -But they don't necessarily have a physical representation in a
120 -document, so simply disallow them in XPointer ranges.
121 -
122 -Found with afl-fuzz.
123 -
124 -Fixes CVE-2016-4658.
125 ----
126 - xpointer.c | 149 +++++++++++++++++++++++--------------------------------------
127 - 1 file changed, 56 insertions(+), 93 deletions(-)
128 -
129 -diff --git a/xpointer.c b/xpointer.c
130 -index a7b03fb..694d120 100644
131 ---- a/xpointer.c
132 -+++ b/xpointer.c
133 -@@ -320,6 +320,45 @@ xmlXPtrRangesEqual(xmlXPathObjectPtr range1, xmlXPathObjectPtr range2) {
134 - }
135 -
136 - /**
137 -+ * xmlXPtrNewRangeInternal:
138 -+ * @start: the starting node
139 -+ * @startindex: the start index
140 -+ * @end: the ending point
141 -+ * @endindex: the ending index
142 -+ *
143 -+ * Internal function to create a new xmlXPathObjectPtr of type range
144 -+ *
145 -+ * Returns the newly created object.
146 -+ */
147 -+static xmlXPathObjectPtr
148 -+xmlXPtrNewRangeInternal(xmlNodePtr start, int startindex,
149 -+ xmlNodePtr end, int endindex) {
150 -+ xmlXPathObjectPtr ret;
151 -+
152 -+ /*
153 -+ * Namespace nodes must be copied (see xmlXPathNodeSetDupNs).
154 -+ * Disallow them for now.
155 -+ */
156 -+ if ((start != NULL) && (start->type == XML_NAMESPACE_DECL))
157 -+ return(NULL);
158 -+ if ((end != NULL) && (end->type == XML_NAMESPACE_DECL))
159 -+ return(NULL);
160 -+
161 -+ ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
162 -+ if (ret == NULL) {
163 -+ xmlXPtrErrMemory("allocating range");
164 -+ return(NULL);
165 -+ }
166 -+ memset(ret, 0, sizeof(xmlXPathObject));
167 -+ ret->type = XPATH_RANGE;
168 -+ ret->user = start;
169 -+ ret->index = startindex;
170 -+ ret->user2 = end;
171 -+ ret->index2 = endindex;
172 -+ return(ret);
173 -+}
174 -+
175 -+/**
176 - * xmlXPtrNewRange:
177 - * @start: the starting node
178 - * @startindex: the start index
179 -@@ -344,17 +383,7 @@ xmlXPtrNewRange(xmlNodePtr start, int startindex,
180 - if (endindex < 0)
181 - return(NULL);
182 -
183 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
184 -- if (ret == NULL) {
185 -- xmlXPtrErrMemory("allocating range");
186 -- return(NULL);
187 -- }
188 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
189 -- ret->type = XPATH_RANGE;
190 -- ret->user = start;
191 -- ret->index = startindex;
192 -- ret->user2 = end;
193 -- ret->index2 = endindex;
194 -+ ret = xmlXPtrNewRangeInternal(start, startindex, end, endindex);
195 - xmlXPtrRangeCheckOrder(ret);
196 - return(ret);
197 - }
198 -@@ -381,17 +410,8 @@ xmlXPtrNewRangePoints(xmlXPathObjectPtr start, xmlXPathObjectPtr end) {
199 - if (end->type != XPATH_POINT)
200 - return(NULL);
201 -
202 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
203 -- if (ret == NULL) {
204 -- xmlXPtrErrMemory("allocating range");
205 -- return(NULL);
206 -- }
207 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
208 -- ret->type = XPATH_RANGE;
209 -- ret->user = start->user;
210 -- ret->index = start->index;
211 -- ret->user2 = end->user;
212 -- ret->index2 = end->index;
213 -+ ret = xmlXPtrNewRangeInternal(start->user, start->index, end->user,
214 -+ end->index);
215 - xmlXPtrRangeCheckOrder(ret);
216 - return(ret);
217 - }
218 -@@ -416,17 +436,7 @@ xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, xmlNodePtr end) {
219 - if (start->type != XPATH_POINT)
220 - return(NULL);
221 -
222 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
223 -- if (ret == NULL) {
224 -- xmlXPtrErrMemory("allocating range");
225 -- return(NULL);
226 -- }
227 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
228 -- ret->type = XPATH_RANGE;
229 -- ret->user = start->user;
230 -- ret->index = start->index;
231 -- ret->user2 = end;
232 -- ret->index2 = -1;
233 -+ ret = xmlXPtrNewRangeInternal(start->user, start->index, end, -1);
234 - xmlXPtrRangeCheckOrder(ret);
235 - return(ret);
236 - }
237 -@@ -453,17 +463,7 @@ xmlXPtrNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) {
238 - if (end->type != XPATH_POINT)
239 - return(NULL);
240 -
241 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
242 -- if (ret == NULL) {
243 -- xmlXPtrErrMemory("allocating range");
244 -- return(NULL);
245 -- }
246 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
247 -- ret->type = XPATH_RANGE;
248 -- ret->user = start;
249 -- ret->index = -1;
250 -- ret->user2 = end->user;
251 -- ret->index2 = end->index;
252 -+ ret = xmlXPtrNewRangeInternal(start, -1, end->user, end->index);
253 - xmlXPtrRangeCheckOrder(ret);
254 - return(ret);
255 - }
256 -@@ -486,17 +486,7 @@ xmlXPtrNewRangeNodes(xmlNodePtr start, xmlNodePtr end) {
257 - if (end == NULL)
258 - return(NULL);
259 -
260 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
261 -- if (ret == NULL) {
262 -- xmlXPtrErrMemory("allocating range");
263 -- return(NULL);
264 -- }
265 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
266 -- ret->type = XPATH_RANGE;
267 -- ret->user = start;
268 -- ret->index = -1;
269 -- ret->user2 = end;
270 -- ret->index2 = -1;
271 -+ ret = xmlXPtrNewRangeInternal(start, -1, end, -1);
272 - xmlXPtrRangeCheckOrder(ret);
273 - return(ret);
274 - }
275 -@@ -516,17 +506,7 @@ xmlXPtrNewCollapsedRange(xmlNodePtr start) {
276 - if (start == NULL)
277 - return(NULL);
278 -
279 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
280 -- if (ret == NULL) {
281 -- xmlXPtrErrMemory("allocating range");
282 -- return(NULL);
283 -- }
284 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
285 -- ret->type = XPATH_RANGE;
286 -- ret->user = start;
287 -- ret->index = -1;
288 -- ret->user2 = NULL;
289 -- ret->index2 = -1;
290 -+ ret = xmlXPtrNewRangeInternal(start, -1, NULL, -1);
291 - return(ret);
292 - }
293 -
294 -@@ -541,6 +521,8 @@ xmlXPtrNewCollapsedRange(xmlNodePtr start) {
295 - */
296 - xmlXPathObjectPtr
297 - xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
298 -+ xmlNodePtr endNode;
299 -+ int endIndex;
300 - xmlXPathObjectPtr ret;
301 -
302 - if (start == NULL)
303 -@@ -549,7 +531,12 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
304 - return(NULL);
305 - switch (end->type) {
306 - case XPATH_POINT:
307 -+ endNode = end->user;
308 -+ endIndex = end->index;
309 -+ break;
310 - case XPATH_RANGE:
311 -+ endNode = end->user2;
312 -+ endIndex = end->index2;
313 - break;
314 - case XPATH_NODESET:
315 - /*
316 -@@ -557,39 +544,15 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
317 - */
318 - if (end->nodesetval->nodeNr <= 0)
319 - return(NULL);
320 -+ endNode = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
321 -+ endIndex = -1;
322 - break;
323 - default:
324 - /* TODO */
325 - return(NULL);
326 - }
327 -
328 -- ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
329 -- if (ret == NULL) {
330 -- xmlXPtrErrMemory("allocating range");
331 -- return(NULL);
332 -- }
333 -- memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
334 -- ret->type = XPATH_RANGE;
335 -- ret->user = start;
336 -- ret->index = -1;
337 -- switch (end->type) {
338 -- case XPATH_POINT:
339 -- ret->user2 = end->user;
340 -- ret->index2 = end->index;
341 -- break;
342 -- case XPATH_RANGE:
343 -- ret->user2 = end->user2;
344 -- ret->index2 = end->index2;
345 -- break;
346 -- case XPATH_NODESET: {
347 -- ret->user2 = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
348 -- ret->index2 = -1;
349 -- break;
350 -- }
351 -- default:
352 -- STRANGE
353 -- return(NULL);
354 -- }
355 -+ ret = xmlXPtrNewRangeInternal(start, -1, endNode, endIndex);
356 - xmlXPtrRangeCheckOrder(ret);
357 - return(ret);
358 - }
359 ---
360 -cgit v0.12
361 -
362
363 diff --git a/dev-libs/libxml2/files/libxml2-2.9.4-CVE-2016-5131.patch b/dev-libs/libxml2/files/libxml2-2.9.4-CVE-2016-5131.patch
364 deleted file mode 100644
365 index 9ce3fb9d871..00000000000
366 --- a/dev-libs/libxml2/files/libxml2-2.9.4-CVE-2016-5131.patch
367 +++ /dev/null
368 @@ -1,174 +0,0 @@
369 -From 9ab01a277d71f54d3143c2cf333c5c2e9aaedd9e Mon Sep 17 00:00:00 2001
370 -From: Nick Wellnhofer <wellnhofer@×××××.de>
371 -Date: Tue, 28 Jun 2016 14:22:23 +0200
372 -Subject: Fix XPointer paths beginning with range-to
373 -
374 -The old code would invoke the broken xmlXPtrRangeToFunction. range-to
375 -isn't really a function but a special kind of location step. Remove
376 -this function and always handle range-to in the XPath code.
377 -
378 -The old xmlXPtrRangeToFunction could also be abused to trigger a
379 -use-after-free error with the potential for remote code execution.
380 -
381 -Found with afl-fuzz.
382 -
383 -Fixes CVE-2016-5131.
384 ----
385 - result/XPath/xptr/vidbase | 13 ++++++++
386 - test/XPath/xptr/vidbase | 1 +
387 - xpath.c | 7 ++++-
388 - xpointer.c | 76 ++++-------------------------------------------
389 - 4 files changed, 26 insertions(+), 71 deletions(-)
390 -
391 -diff --git a/result/XPath/xptr/vidbase b/result/XPath/xptr/vidbase
392 -index 8b9e92d..f19193e 100644
393 ---- a/result/XPath/xptr/vidbase
394 -+++ b/result/XPath/xptr/vidbase
395 -@@ -17,3 +17,16 @@ Object is a Location Set:
396 - To node
397 - ELEMENT p
398 -
399 -+
400 -+========================
401 -+Expression: xpointer(range-to(id('chapter2')))
402 -+Object is a Location Set:
403 -+1 : Object is a range :
404 -+ From node
405 -+ /
406 -+ To node
407 -+ ELEMENT chapter
408 -+ ATTRIBUTE id
409 -+ TEXT
410 -+ content=chapter2
411 -+
412 -diff --git a/test/XPath/xptr/vidbase b/test/XPath/xptr/vidbase
413 -index b146383..884b106 100644
414 ---- a/test/XPath/xptr/vidbase
415 -+++ b/test/XPath/xptr/vidbase
416 -@@ -1,2 +1,3 @@
417 - xpointer(id('chapter1')/p)
418 - xpointer(id('chapter1')/p[1]/range-to(following-sibling::p[2]))
419 -+xpointer(range-to(id('chapter2')))
420 -diff --git a/xpath.c b/xpath.c
421 -index d992841..5a01b1b 100644
422 ---- a/xpath.c
423 -+++ b/xpath.c
424 -@@ -10691,13 +10691,18 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) {
425 - lc = 1;
426 - break;
427 - } else if ((NXT(len) == '(')) {
428 -- /* Note Type or Function */
429 -+ /* Node Type or Function */
430 - if (xmlXPathIsNodeType(name)) {
431 - #ifdef DEBUG_STEP
432 - xmlGenericError(xmlGenericErrorContext,
433 - "PathExpr: Type search\n");
434 - #endif
435 - lc = 1;
436 -+#ifdef LIBXML_XPTR_ENABLED
437 -+ } else if (ctxt->xptr &&
438 -+ xmlStrEqual(name, BAD_CAST "range-to")) {
439 -+ lc = 1;
440 -+#endif
441 - } else {
442 - #ifdef DEBUG_STEP
443 - xmlGenericError(xmlGenericErrorContext,
444 -diff --git a/xpointer.c b/xpointer.c
445 -index 676c510..d74174a 100644
446 ---- a/xpointer.c
447 -+++ b/xpointer.c
448 -@@ -1332,8 +1332,6 @@ xmlXPtrNewContext(xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin) {
449 - ret->here = here;
450 - ret->origin = origin;
451 -
452 -- xmlXPathRegisterFunc(ret, (xmlChar *)"range-to",
453 -- xmlXPtrRangeToFunction);
454 - xmlXPathRegisterFunc(ret, (xmlChar *)"range",
455 - xmlXPtrRangeFunction);
456 - xmlXPathRegisterFunc(ret, (xmlChar *)"range-inside",
457 -@@ -2243,76 +2241,14 @@ xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) {
458 - * @nargs: the number of args
459 - *
460 - * Implement the range-to() XPointer function
461 -+ *
462 -+ * Obsolete. range-to is not a real function but a special type of location
463 -+ * step which is handled in xpath.c.
464 - */
465 - void
466 --xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) {
467 -- xmlXPathObjectPtr range;
468 -- const xmlChar *cur;
469 -- xmlXPathObjectPtr res, obj;
470 -- xmlXPathObjectPtr tmp;
471 -- xmlLocationSetPtr newset = NULL;
472 -- xmlNodeSetPtr oldset;
473 -- int i;
474 --
475 -- if (ctxt == NULL) return;
476 -- CHECK_ARITY(1);
477 -- /*
478 -- * Save the expression pointer since we will have to evaluate
479 -- * it multiple times. Initialize the new set.
480 -- */
481 -- CHECK_TYPE(XPATH_NODESET);
482 -- obj = valuePop(ctxt);
483 -- oldset = obj->nodesetval;
484 -- ctxt->context->node = NULL;
485 --
486 -- cur = ctxt->cur;
487 -- newset = xmlXPtrLocationSetCreate(NULL);
488 --
489 -- for (i = 0; i < oldset->nodeNr; i++) {
490 -- ctxt->cur = cur;
491 --
492 -- /*
493 -- * Run the evaluation with a node list made of a single item
494 -- * in the nodeset.
495 -- */
496 -- ctxt->context->node = oldset->nodeTab[i];
497 -- tmp = xmlXPathNewNodeSet(ctxt->context->node);
498 -- valuePush(ctxt, tmp);
499 --
500 -- xmlXPathEvalExpr(ctxt);
501 -- CHECK_ERROR;
502 --
503 -- /*
504 -- * The result of the evaluation need to be tested to
505 -- * decided whether the filter succeeded or not
506 -- */
507 -- res = valuePop(ctxt);
508 -- range = xmlXPtrNewRangeNodeObject(oldset->nodeTab[i], res);
509 -- if (range != NULL) {
510 -- xmlXPtrLocationSetAdd(newset, range);
511 -- }
512 --
513 -- /*
514 -- * Cleanup
515 -- */
516 -- if (res != NULL)
517 -- xmlXPathFreeObject(res);
518 -- if (ctxt->value == tmp) {
519 -- res = valuePop(ctxt);
520 -- xmlXPathFreeObject(res);
521 -- }
522 --
523 -- ctxt->context->node = NULL;
524 -- }
525 --
526 -- /*
527 -- * The result is used as the new evaluation set.
528 -- */
529 -- xmlXPathFreeObject(obj);
530 -- ctxt->context->node = NULL;
531 -- ctxt->context->contextSize = -1;
532 -- ctxt->context->proximityPosition = -1;
533 -- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
534 -+xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt,
535 -+ int nargs ATTRIBUTE_UNUSED) {
536 -+ XP_ERROR(XPATH_EXPR_ERROR);
537 - }
538 -
539 - /**
540 ---
541 -cgit v0.12
542 -
543
544 diff --git a/dev-libs/libxml2/files/libxml2-2.9.4-nullptrderef.patch b/dev-libs/libxml2/files/libxml2-2.9.4-nullptrderef.patch
545 deleted file mode 100644
546 index d2a9c3e2add..00000000000
547 --- a/dev-libs/libxml2/files/libxml2-2.9.4-nullptrderef.patch
548 +++ /dev/null
549 @@ -1,50 +0,0 @@
550 -From e905f08123e4a6e7731549e6f09dadff4cab65bd Mon Sep 17 00:00:00 2001
551 -From: Nick Wellnhofer <wellnhofer@×××××.de>
552 -Date: Sun, 26 Jun 2016 12:38:28 +0200
553 -Subject: Fix more NULL pointer derefs in xpointer.c
554 -
555 -Found with afl-fuzz.
556 ----
557 - xpointer.c | 12 +++++++-----
558 - 1 file changed, 7 insertions(+), 5 deletions(-)
559 -
560 -diff --git a/xpointer.c b/xpointer.c
561 -index 694d120..e643ee9 100644
562 ---- a/xpointer.c
563 -+++ b/xpointer.c
564 -@@ -542,7 +542,7 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) {
565 - /*
566 - * Empty set ...
567 - */
568 -- if (end->nodesetval->nodeNr <= 0)
569 -+ if ((end->nodesetval == NULL) || (end->nodesetval->nodeNr <= 0))
570 - return(NULL);
571 - endNode = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
572 - endIndex = -1;
573 -@@ -1361,7 +1361,7 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) {
574 - */
575 - xmlNodeSetPtr set;
576 - set = tmp->nodesetval;
577 -- if ((set->nodeNr != 1) ||
578 -+ if ((set == NULL) || (set->nodeNr != 1) ||
579 - (set->nodeTab[0] != (xmlNodePtr) ctx->doc))
580 - stack++;
581 - } else
582 -@@ -2034,9 +2034,11 @@ xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
583 - xmlXPathFreeObject(set);
584 - XP_ERROR(XPATH_MEMORY_ERROR);
585 - }
586 -- for (i = 0;i < oldset->locNr;i++) {
587 -- xmlXPtrLocationSetAdd(newset,
588 -- xmlXPtrCoveringRange(ctxt, oldset->locTab[i]));
589 -+ if (oldset != NULL) {
590 -+ for (i = 0;i < oldset->locNr;i++) {
591 -+ xmlXPtrLocationSetAdd(newset,
592 -+ xmlXPtrCoveringRange(ctxt, oldset->locTab[i]));
593 -+ }
594 - }
595 -
596 - /*
597 ---
598 -cgit v0.12
599 -
600
601 diff --git a/dev-libs/libxml2/files/libxml2-2.9.4-nullptrderef2.patch b/dev-libs/libxml2/files/libxml2-2.9.4-nullptrderef2.patch
602 deleted file mode 100644
603 index 2484f76e7b0..00000000000
604 --- a/dev-libs/libxml2/files/libxml2-2.9.4-nullptrderef2.patch
605 +++ /dev/null
606 @@ -1,57 +0,0 @@
607 -From d8083bf77955b7879c1290f0c0a24ab8cc70f7fb Mon Sep 17 00:00:00 2001
608 -From: Nick Wellnhofer <wellnhofer@×××××.de>
609 -Date: Sat, 25 Jun 2016 12:35:50 +0200
610 -Subject: Fix NULL pointer deref in XPointer range-to
611 -
612 -- Check for errors after evaluating first operand.
613 -- Add sanity check for empty stack.
614 -
615 -Found with afl-fuzz.
616 ----
617 - result/XPath/xptr/viderror | 4 ++++
618 - test/XPath/xptr/viderror | 1 +
619 - xpath.c | 7 ++++++-
620 - 3 files changed, 11 insertions(+), 1 deletion(-)
621 - create mode 100644 result/XPath/xptr/viderror
622 - create mode 100644 test/XPath/xptr/viderror
623 -
624 -diff --git a/result/XPath/xptr/viderror b/result/XPath/xptr/viderror
625 -new file mode 100644
626 -index 0000000..d589882
627 ---- /dev/null
628 -+++ b/result/XPath/xptr/viderror
629 -@@ -0,0 +1,4 @@
630 -+
631 -+========================
632 -+Expression: xpointer(non-existing-fn()/range-to(id('chapter2')))
633 -+Object is empty (NULL)
634 -diff --git a/test/XPath/xptr/viderror b/test/XPath/xptr/viderror
635 -new file mode 100644
636 -index 0000000..da8c53b
637 ---- /dev/null
638 -+++ b/test/XPath/xptr/viderror
639 -@@ -0,0 +1 @@
640 -+xpointer(non-existing-fn()/range-to(id('chapter2')))
641 -diff --git a/xpath.c b/xpath.c
642 -index 113bce6..751665b 100644
643 ---- a/xpath.c
644 -+++ b/xpath.c
645 -@@ -14005,9 +14005,14 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
646 - xmlNodeSetPtr oldset;
647 - int i, j;
648 -
649 -- if (op->ch1 != -1)
650 -+ if (op->ch1 != -1) {
651 - total +=
652 - xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
653 -+ CHECK_ERROR0;
654 -+ }
655 -+ if (ctxt->value == NULL) {
656 -+ XP_ERROR0(XPATH_INVALID_OPERAND);
657 -+ }
658 - if (op->ch2 == -1)
659 - return (total);
660 -
661 ---
662 -cgit v0.12
663 -
664
665 diff --git a/dev-libs/libxml2/libxml2-2.9.4-r1.ebuild b/dev-libs/libxml2/libxml2-2.9.4-r1.ebuild
666 deleted file mode 100644
667 index 8df1fd22c8e..00000000000
668 --- a/dev-libs/libxml2/libxml2-2.9.4-r1.ebuild
669 +++ /dev/null
670 @@ -1,220 +0,0 @@
671 -# Copyright 1999-2018 Gentoo Foundation
672 -# Distributed under the terms of the GNU General Public License v2
673 -
674 -EAPI=6
675 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
676 -PYTHON_REQ_USE="xml"
677 -
678 -inherit libtool flag-o-matic ltprune python-r1 autotools prefix multilib-minimal
679 -
680 -DESCRIPTION="Version 2 of the library to manipulate XML files"
681 -HOMEPAGE="http://www.xmlsoft.org/"
682 -
683 -LICENSE="MIT"
684 -SLOT="2"
685 -KEYWORDS="arm64 m68k s390 sh"
686 -IUSE="debug examples icu ipv6 lzma python readline static-libs test"
687 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
688 -
689 -XSTS_HOME="http://www.w3.org/XML/2004/xml-schema-test-suite"
690 -XSTS_NAME_1="xmlschema2002-01-16"
691 -XSTS_NAME_2="xmlschema2004-01-14"
692 -XSTS_TARBALL_1="xsts-2002-01-16.tar.gz"
693 -XSTS_TARBALL_2="xsts-2004-01-14.tar.gz"
694 -XMLCONF_TARBALL="xmlts20080827.tar.gz"
695 -
696 -SRC_URI="ftp://xmlsoft.org/${PN}/${PN}-${PV/_rc/-rc}.tar.gz
697 - test? (
698 - ${XSTS_HOME}/${XSTS_NAME_1}/${XSTS_TARBALL_1}
699 - ${XSTS_HOME}/${XSTS_NAME_2}/${XSTS_TARBALL_2}
700 - http://www.w3.org/XML/Test/${XMLCONF_TARBALL} )"
701 -
702 -RDEPEND="
703 - >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}]
704 - icu? ( >=dev-libs/icu-51.2-r1:=[${MULTILIB_USEDEP}] )
705 - lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] )
706 - python? ( ${PYTHON_DEPS} )
707 - readline? ( sys-libs/readline:= )
708 -"
709 -DEPEND="${RDEPEND}
710 - dev-util/gtk-doc-am
711 - virtual/pkgconfig
712 - hppa? ( >=sys-devel/binutils-2.15.92.0.2 )
713 -"
714 -
715 -S="${WORKDIR}/${PN}-${PV%_rc*}"
716 -
717 -MULTILIB_CHOST_TOOLS=(
718 - /usr/bin/xml2-config
719 -)
720 -
721 -src_unpack() {
722 - # ${A} isn't used to avoid unpacking of test tarballs into $WORKDIR,
723 - # as they are needed as tarballs in ${S}/xstc instead and not unpacked
724 - unpack ${P/_rc/-rc}.tar.gz
725 - cd "${S}" || die
726 -
727 - if use test; then
728 - cp "${DISTDIR}/${XSTS_TARBALL_1}" \
729 - "${DISTDIR}/${XSTS_TARBALL_2}" \
730 - "${S}"/xstc/ \
731 - || die "Failed to install test tarballs"
732 - unpack ${XMLCONF_TARBALL}
733 - fi
734 -}
735 -
736 -src_prepare() {
737 - default
738 -
739 - DOCS=( AUTHORS ChangeLog NEWS README* TODO* )
740 -
741 - # Patches needed for prefix support
742 - eapply "${FILESDIR}"/${PN}-2.7.1-catalog_path.patch
743 -
744 - eprefixify catalog.c xmlcatalog.c runtest.c xmllint.c
745 -
746 - # Fix build for Windows platform
747 - # https://bugzilla.gnome.org/show_bug.cgi?id=760456
748 - eapply "${FILESDIR}"/${PN}-2.8.0_rc1-winnt.patch
749 -
750 - # Disable programs that we don't actually install.
751 - # https://bugzilla.gnome.org/show_bug.cgi?id=760457
752 - eapply "${FILESDIR}"/${PN}-2.9.2-disable-tests.patch
753 -
754 - # Fix python detection, bug #567066
755 - # https://bugzilla.gnome.org/show_bug.cgi?id=760458
756 - eapply "${FILESDIR}"/${PN}-2.9.2-python-ABIFLAG.patch
757 -
758 - # Apply latest round of security patches wrt bugs
759 - # 589816, 597112, 597114, 597116. This will be included
760 - # in the next upstream release
761 - eapply "${FILESDIR}"/${PN}-2.9.4-CVE-2016-4658.patch
762 - eapply "${FILESDIR}"/${PN}-2.9.4-CVE-2016-5131.patch
763 - eapply "${FILESDIR}"/${PN}-2.9.4-nullptrderef.patch
764 - eapply "${FILESDIR}"/${PN}-2.9.4-nullptrderef2.patch
765 -
766 - # Avoid final linking arguments for python modules
767 - if [[ ${CHOST} == *-darwin* ]] ; then
768 - sed -i -e '/PYTHON_LIBS/s/ldflags/libs/' configure.ac || die
769 - fi
770 -
771 - # Please do not remove, as else we get references to PORTAGE_TMPDIR
772 - # in /usr/lib/python?.?/site-packages/libxml2mod.la among things.
773 - # We now need to run eautoreconf at the end to prevent maintainer mode.
774 -# elibtoolize
775 -# epunt_cxx # if we don't eautoreconf
776 -
777 - eautoreconf
778 -}
779 -
780 -multilib_src_configure() {
781 - # filter seemingly problematic CFLAGS (#26320)
782 - filter-flags -fprefetch-loop-arrays -funroll-loops
783 -
784 - # USE zlib support breaks gnome2
785 - # (libgnomeprint for instance fails to compile with
786 - # fresh install, and existing) - <azarah@g.o> (22 Dec 2002).
787 -
788 - # The meaning of the 'debug' USE flag does not apply to the --with-debug
789 - # switch (enabling the libxml2 debug module). See bug #100898.
790 -
791 - # --with-mem-debug causes unusual segmentation faults (bug #105120).
792 -
793 - libxml2_configure() {
794 - ECONF_SOURCE="${S}" econf \
795 - --with-html-subdir=${PF}/html \
796 - $(use_with debug run-debug) \
797 - $(use_with icu) \
798 - $(use_with lzma) \
799 - $(use_enable ipv6) \
800 - $(use_enable static-libs static) \
801 - $(multilib_native_use_with readline) \
802 - $(multilib_native_use_with readline history) \
803 - "$@"
804 - }
805 -
806 - libxml2_py_configure() {
807 - mkdir -p "${BUILD_DIR}" || die # ensure python build dirs exist
808 - run_in_build_dir libxml2_configure "--with-python=${ROOT%/}${PYTHON}" # odd build system, also see bug #582130
809 - }
810 -
811 - libxml2_configure --without-python # build python bindings separately
812 -
813 - if multilib_is_native_abi && use python; then
814 - python_foreach_impl libxml2_py_configure
815 - fi
816 -}
817 -
818 -multilib_src_compile() {
819 - default
820 - if multilib_is_native_abi && use python; then
821 - local native_builddir=${BUILD_DIR}
822 - python_foreach_impl libxml2_py_emake top_builddir="${native_builddir}" all
823 - fi
824 -}
825 -
826 -multilib_src_test() {
827 - default
828 - multilib_is_native_abi && use python && python_foreach_impl libxml2_py_emake test
829 -}
830 -
831 -multilib_src_install() {
832 - emake DESTDIR="${D}" \
833 - EXAMPLES_DIR="${EPREFIX}"/usr/share/doc/${PF}/examples install
834 -
835 - if multilib_is_native_abi && use python; then
836 - python_foreach_impl libxml2_py_emake \
837 - DESTDIR="${D}" \
838 - docsdir="${EPREFIX}"/usr/share/doc/${PF}/python \
839 - exampledir="${EPREFIX}"/usr/share/doc/${PF}/python/examples \
840 - install
841 - python_foreach_impl python_optimize
842 - fi
843 -}
844 -
845 -multilib_src_install_all() {
846 - # on windows, xmllint is installed by interix libxml2 in parent prefix.
847 - # this is the version to use. the native winnt version does not support
848 - # symlinks, which makes repoman fail if the portage tree is linked in
849 - # from another location (which is my default). -- mduft
850 - if [[ ${CHOST} == *-winnt* ]]; then
851 - rm -rf "${ED}"/usr/bin/xmllint
852 - rm -rf "${ED}"/usr/bin/xmlcatalog
853 - fi
854 -
855 - rm -rf "${ED}"/usr/share/doc/${P}
856 - einstalldocs
857 -
858 - if ! use examples; then
859 - rm -rf "${ED}"/usr/share/doc/${PF}/examples
860 - rm -rf "${ED}"/usr/share/doc/${PF}/python/examples
861 - fi
862 -
863 - prune_libtool_files --modules
864 -}
865 -
866 -pkg_postinst() {
867 - # We don't want to do the xmlcatalog during stage1, as xmlcatalog will not
868 - # be in / and stage1 builds to ROOT=/tmp/stage1root. This fixes bug #208887.
869 - if [[ "${ROOT}" != "/" ]]; then
870 - elog "Skipping XML catalog creation for stage building (bug #208887)."
871 - else
872 - # need an XML catalog, so no-one writes to a non-existent one
873 - CATALOG="${EROOT}etc/xml/catalog"
874 -
875 - # we dont want to clobber an existing catalog though,
876 - # only ensure that one is there
877 - # <obz@g.o>
878 - if [[ ! -e ${CATALOG} ]]; then
879 - [[ -d "${EROOT}etc/xml" ]] || mkdir -p "${EROOT}etc/xml"
880 - "${EPREFIX}"/usr/bin/xmlcatalog --create > "${CATALOG}"
881 - einfo "Created XML catalog in ${CATALOG}"
882 - fi
883 - fi
884 -}
885 -
886 -libxml2_py_emake() {
887 - pushd "${BUILD_DIR}/python" > /dev/null || die
888 - emake "$@"
889 - popd > /dev/null
890 -}