# ChangeLog for dev-libs/libxml2
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/ChangeLog,v 1.313 2011/10/14 21:18:06 ssuominen Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/ChangeLog,v 1.314 2011/10/15 22:11:40 pacho Exp $
+
+*libxml2-2.7.8-r3 (15 Oct 2011)
+
+ 15 Oct 2011; Pacho Ramos <pacho@gentoo.org> -libxml2-2.7.8.ebuild,
+ +libxml2-2.7.8-r3.ebuild, +files/libxml2-2.7.8-error-xpath.patch,
+ +files/libxml2-2.7.8-hardening-xpath.patch:
+ Fix CVE-2011-{2821,2834}, bug #386985, thanks to Michael Harrison and Tim
+ Sammut. Remove old.
14 Oct 2011; Samuli Suominen <ssuominen@gentoo.org> libxml2-2.7.8-r2.ebuild:
amd64 stable wrt #385699
AUX libxml2-2.7.1-catalog_path.patch 2209 RMD160 0306a8611cde6a7b78f5fd43c93ebbfddc6607e7 SHA1 bec0ee91757e2fa093c89d6eba1821f40878f002 SHA256 b3343f0611f9cb6e55bf62047a988653e3e9cc50f194b18adbc330b455236290
AUX libxml2-2.7.2-winnt.patch 2120 RMD160 943293107d0c8313a525c2516f06861c013d9777 SHA1 4e68c44fe1b932c7d61b06bffb4d634701e29e0a SHA256 63cb134dbef1b7be1b9dc400da8aef1816436a193a2f97db0028cdd70e3e4cf0
AUX libxml2-2.7.8-disable_static_modules.patch 365 RMD160 aedfb1647c21a27d1d170a17cc6e15f1015c6047 SHA1 23eb1145762d4ec4b05b8118b54e7eef15cdf991 SHA256 2f2ade9ee034af32cbd6600d45b2e23d3153dd9bb57a07a9f364836d24b189df
+AUX libxml2-2.7.8-error-xpath.patch 2897 RMD160 eaa46dcb8c968d5b79e633fe12ed052e29e9c870 SHA1 22a43c57e114af9c10c4d6adc580bae45972c547 SHA256 2b2ee18463baa212539f1c8747e549e6ed18e49989ebaa42843729524f1cf253
+AUX libxml2-2.7.8-hardening-xpath.patch 7579 RMD160 2a3739e9de88af87f866a0a6564277991b251d49 SHA1 544e5949731fdc0bed7f2e2adf444afe87d6f963 SHA256 7eac2cd552158347244806730e2b8a4c09e39cddfcf67ed74a5ec989763abbfe
AUX libxml2-2.7.8-reactivate-script.patch 628 RMD160 7c0da0a849af6f98e176acd595b8cf8fcc3e41e8 SHA1 90cd59c02e8043a66eb37b06c261a49c08f907cf SHA256 379102cf7547c47fdcc94daecb310e55b80bd157ea5280d72194eedf9ad371de
AUX libxml2-2.7.8-reallocation-failures.patch 3465 RMD160 4faa06af94d418fb33b5aa0791e5f320287c073e SHA1 9b275f97479b74c0af94560ed8e1d0c894ad4701 SHA256 8a115c7ead8612ff7f8bd1e36615ebf20dbe42d3e79f216ee66d5cf6a59f02d6
AUX libxml2-2.7.8-xpath-freeing.patch 1042 RMD160 ecd781d93ba067cea9448ef02e408c2002ce019c SHA1 87eff7814372ef5dd224c7079106cf1fcb35bf3f SHA256 655a1cd96df3bcbd02e3a7fe9b812ee7e116dea036a9a5bfb529be714f288e87
DIST xsts-2004-01-14.tar.gz 2761085 RMD160 faff2d7826e47ae9968564bc83dab1b54c5e4bf6 SHA1 5896c2aa2cda464246306c5cf0577ed506eefaab SHA256 09bdf9f81f381ebf9bc158a9472e498e896f7a02eb7461146e9abe1b9493ca17
EBUILD libxml2-2.7.8-r1.ebuild 6317 RMD160 6e2aed484b333ad7960ab6f304220f708f52cbbb SHA1 014a4188e33b80bb2e5964c24cf2b802050e099b SHA256 a2411881d85278bbfd779982c9afa2fac70d06ce21665b379e3c075a72ae0877
EBUILD libxml2-2.7.8-r2.ebuild 6512 RMD160 32d04d1d053e6a4d206a8edb7f97ba2332a7b97c SHA1 89dc922d19f55da73fa1fdfd2549b5dac56b6426 SHA256 ba45d5a1f71c53fca3272b829da3193608ea77fa569172e7dc6e1e5cde42213e
-EBUILD libxml2-2.7.8.ebuild 6200 RMD160 0f12eaa8761ed413c1b117520af99cf37ccaa494 SHA1 a788a2c0789c667d9240510268bb87eaf9048457 SHA256 13bbb131d0d3f0a1c58b5a77353aa48817e679c7645ea20a1208b4f6b2f3921f
-MISC ChangeLog 42557 RMD160 05da016bb0be5dd9e1ce953e78a476235ec5a67c SHA1 514b543d36cb5ba781715aab6cc421784a341049 SHA256 691f9cf1b4457e5992c8ff75f133ec8c693457b1ab3c8b7b28b872391b949ec9
+EBUILD libxml2-2.7.8-r3.ebuild 6686 RMD160 f0871ca6a15a04fd621a24414ddff0023e1a7815 SHA1 4de303adee0faba701e016a1d2e118f8bdfe481e SHA256 cbd3b2ce2ca8d1802c5bd43215e4490ea2bf8a0cfc2dccbe3ba8c9129d5dd419
+MISC ChangeLog 42868 RMD160 dd38ba0c8e39ce226381723f7667f42d8a1d81e5 SHA1 1fd784f2513b8d7215e06432226500dd849e0068 SHA256 ce66635be26adabd8638d0b3b2d4f018b364113b850812c671cb95cddc9a573c
MISC metadata.xml 158 RMD160 c0e2bae8e91bb6be8922bac5e4f597302e06587e SHA1 38f78e9790bcd4382b4a49aa226aa6dda1d3a3d7 SHA256 3a7dbca0fdc557de69783e0663e2d76ddab129ea8a19b2d0ef6d3e5d1b947ce1
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.18 (GNU/Linux)
+Version: GnuPG v2.0.17 (GNU/Linux)
-iQEcBAEBAgAGBQJOmKcNAAoJEEdUh39IaPFNWKIH/j5aFEm1Uv+k8XVe3IKrDpaT
-IyccjZ0XZQBK/JwnI+SEi05KNehf02dAqVARw/M46hnbClUol6mGxg/0onANnwV/
-o8J6wk3t9YrUOKkiS+aWboP6denXbh/oOGlr+VfRKbfm47Kmm8A1K/xgqMdijn3w
-0IUf6viOxzKzx0caJ84fIWzZjmn/lxxpMsD6g/ljLq7oyh67LlmLZischufMzly1
-J1kKrSX8HuuU7wuF8Auv+BeVUhQiBoHbVbd2NhqjIbv4mHYVuQ1mPnVC+2u81V0S
-UxTLW0XA9w6quW7K8QEit94brikayY3E1LbFjLIL1YN6i8abexDWEtUxu6NPl8Q=
-=DQqB
+iEYEARECAAYFAk6aBSMACgkQCaWpQKGI+9TJbACeNqaC7cMMyBSwVpsYenu7MZpp
+/RYAn03QyxtlzPWwq8WNkPtMLmSsskvM
+=xzgg
-----END PGP SIGNATURE-----
--- /dev/null
+From 1d4526f6f4ec8d18c40e2a09b387652a6c1aa2cd Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Tue, 11 Oct 2011 08:34:34 +0000
+Subject: Fix missing error status in XPath evaluation
+
+Started by Chris Evans, I added a few more place where the
+error should have been set in the evaluation context.
+---
+diff --git a/xpath.c b/xpath.c
+index bcee2ea..d9d902c 100644
+--- a/xpath.c
++++ b/xpath.c
+@@ -2485,6 +2485,7 @@ valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
+ sizeof(ctxt->valueTab[0]));
+ if (tmp == NULL) {
+ xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
++ ctxt->error = XPATH_MEMORY_ERROR;
+ return (0);
+ }
+ ctxt->valueMax *= 2;
+@@ -9340,6 +9341,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+ if ( (ch & 0xc0) != 0xc0 ) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathTranslateFunction: Invalid UTF8 string\n");
++ /* not asserting an XPath error is probably better */
+ break;
+ }
+ /* then skip over remaining bytes for this char */
+@@ -9347,6 +9349,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+ if ( (*cptr++ & 0xc0) != 0x80 ) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathTranslateFunction: Invalid UTF8 string\n");
++ /* not asserting an XPath error is probably better */
+ break;
+ }
+ if (ch & 0x80) /* must have had error encountered */
+@@ -13410,6 +13413,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
+ (char *) op->value4, (char *)op->value5);
++ ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
+ return (total);
+ }
+ val = xmlXPathVariableLookupNS(ctxt->context,
+@@ -13464,6 +13468,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
+ (char *)op->value4, (char *)op->value5);
+ xmlXPathPopFrame(ctxt, frame);
++ ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
+ return (total);
+ }
+ func = xmlXPathFunctionLookupNS(ctxt->context,
+@@ -14042,6 +14047,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ }
+ xmlGenericError(xmlGenericErrorContext,
+ "XPath: unknown precompiled operation %d\n", op->op);
++ ctxt->error = XPATH_INVALID_OPERAND;
+ return (total);
+ }
+
+--
+cgit v0.9.0.2
--- /dev/null
+From f5048b3e71fc30ad096970b8df6e7af073bae4cb Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 18 Aug 2011 09:10:13 +0000
+Subject: Hardening of XPath evaluation
+
+Add a mechanism of frame for XPath evaluation when entering a function
+or a scoped evaluation, also fix a potential problem in predicate
+evaluation.
+---
+diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
+index 1a9e30e..ddd9dd8 100644
+--- a/include/libxml/xpath.h
++++ b/include/libxml/xpath.h
+@@ -68,7 +68,8 @@ typedef enum {
+ XPATH_UNDEF_PREFIX_ERROR,
+ XPATH_ENCODING_ERROR,
+ XPATH_INVALID_CHAR_ERROR,
+- XPATH_INVALID_CTXT
++ XPATH_INVALID_CTXT,
++ XPATH_STACK_ERROR
+ } xmlXPathError;
+
+ /*
+@@ -380,6 +381,8 @@ struct _xmlXPathParserContext {
+ xmlXPathCompExprPtr comp; /* the precompiled expression */
+ int xptr; /* it this an XPointer expression */
+ xmlNodePtr ancestor; /* used for walking preceding axis */
++
++ int valueFrame; /* used to limit Pop on the stack */
+ };
+
+ /************************************************************************
+diff --git a/xpath.c b/xpath.c
+index b59ac5a..bcee2ea 100644
+--- a/xpath.c
++++ b/xpath.c
+@@ -252,6 +252,7 @@ static const char *xmlXPathErrorMessages[] = {
+ "Encoding error\n",
+ "Char out of XML range\n",
+ "Invalid or incomplete context\n",
++ "Stack usage errror\n",
+ "?? Unknown error ??\n" /* Must be last in the list! */
+ };
+ #define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) / \
+@@ -2398,6 +2399,42 @@ xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) {
+ ************************************************************************/
+
+ /**
++ * xmlXPathSetFrame:
++ * @ctxt: an XPath parser context
++ *
++ * Set the callee evaluation frame
++ *
++ * Returns the previous frame value to be restored once done
++ */
++static int
++xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) {
++ int ret;
++
++ if (ctxt == NULL)
++ return(0);
++ ret = ctxt->valueFrame;
++ ctxt->valueFrame = ctxt->valueNr;
++ return(ret);
++}
++
++/**
++ * xmlXPathPopFrame:
++ * @ctxt: an XPath parser context
++ * @frame: the previous frame value
++ *
++ * Remove the callee evaluation frame
++ */
++static void
++xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) {
++ if (ctxt == NULL)
++ return;
++ if (ctxt->valueNr < ctxt->valueFrame) {
++ xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
++ }
++ ctxt->valueFrame = frame;
++}
++
++/**
+ * valuePop:
+ * @ctxt: an XPath evaluation context
+ *
+@@ -2412,6 +2449,12 @@ valuePop(xmlXPathParserContextPtr ctxt)
+
+ if ((ctxt == NULL) || (ctxt->valueNr <= 0))
+ return (NULL);
++
++ if (ctxt->valueNr <= ctxt->valueFrame) {
++ xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
++ return (NULL);
++ }
++
+ ctxt->valueNr--;
+ if (ctxt->valueNr > 0)
+ ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
+@@ -6154,6 +6197,7 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
+ ret->valueNr = 0;
+ ret->valueMax = 10;
+ ret->value = NULL;
++ ret->valueFrame = 0;
+
+ ret->context = ctxt;
+ ret->comp = comp;
+@@ -11711,6 +11755,7 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
+ xmlXPathObjectPtr contextObj = NULL, exprRes = NULL;
+ xmlNodePtr oldContextNode, contextNode = NULL;
+ xmlXPathContextPtr xpctxt = ctxt->context;
++ int frame;
+
+ #ifdef LIBXML_XPTR_ENABLED
+ /*
+@@ -11730,6 +11775,8 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
+ */
+ exprOp = &ctxt->comp->steps[op->ch2];
+ for (i = 0; i < set->nodeNr; i++) {
++ xmlXPathObjectPtr tmp;
++
+ if (set->nodeTab[i] == NULL)
+ continue;
+
+@@ -11757,23 +11804,25 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
+ xmlXPathNodeSetAddUnique(contextObj->nodesetval,
+ contextNode);
+
++ frame = xmlXPathSetFrame(ctxt);
+ valuePush(ctxt, contextObj);
+ res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
++ tmp = valuePop(ctxt);
++ xmlXPathPopFrame(ctxt, frame);
+
+ if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
+- xmlXPathObjectPtr tmp;
+- /* pop the result if any */
+- tmp = valuePop(ctxt);
+- if (tmp != contextObj) {
++ while (tmp != contextObj) {
+ /*
+ * Free up the result
+ * then pop off contextObj, which will be freed later
+ */
+ xmlXPathReleaseObject(xpctxt, tmp);
+- valuePop(ctxt);
++ tmp = valuePop(ctxt);
+ }
+ goto evaluation_error;
+ }
++ /* push the result back onto the stack */
++ valuePush(ctxt, tmp);
+
+ if (res)
+ pos++;
+@@ -13377,7 +13426,9 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ xmlXPathFunction func;
+ const xmlChar *oldFunc, *oldFuncURI;
+ int i;
++ int frame;
+
++ frame = xmlXPathSetFrame(ctxt);
+ if (op->ch1 != -1)
+ total +=
+ xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
+@@ -13385,15 +13436,18 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: parameter error\n");
+ ctxt->error = XPATH_INVALID_OPERAND;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
+- for (i = 0; i < op->value; i++)
++ for (i = 0; i < op->value; i++) {
+ if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: parameter error\n");
+ ctxt->error = XPATH_INVALID_OPERAND;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
++ }
+ if (op->cache != NULL)
+ XML_CAST_FPTR(func) = op->cache;
+ else {
+@@ -13409,6 +13463,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
+ (char *)op->value4, (char *)op->value5);
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
+ func = xmlXPathFunctionLookupNS(ctxt->context,
+@@ -13430,6 +13485,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
+ func(ctxt, op->value);
+ ctxt->context->function = oldFunc;
+ ctxt->context->functionURI = oldFuncURI;
++ xmlXPathPopFrame(ctxt, frame);
+ return (total);
+ }
+ case XPATH_OP_ARG:
+@@ -14333,6 +14389,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool)
+ ctxt->valueNr = 0;
+ ctxt->valueMax = 10;
+ ctxt->value = NULL;
++ ctxt->valueFrame = 0;
+ }
+ #ifdef XPATH_STREAMING
+ if (ctxt->comp->stream) {
+diff --git a/xpointer.c b/xpointer.c
+index 7a42d02..37afa3a 100644
+--- a/xpointer.c
++++ b/xpointer.c
+@@ -1269,6 +1269,7 @@ xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) {
+ ctxt->valueNr = 0;
+ ctxt->valueMax = 10;
+ ctxt->value = NULL;
++ ctxt->valueFrame = 0;
+ }
+ SKIP_BLANKS;
+ if (CUR == '/') {
+--
+cgit v0.9.0.2
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/libxml2-2.7.8.ebuild,v 1.9 2011/02/26 17:17:33 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/libxml2-2.7.8-r3.ebuild,v 1.1 2011/10/15 22:11:40 pacho Exp $
EAPI="3"
PYTHON_DEPEND="python? 2"
LICENSE="MIT"
SLOT="2"
-KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-IUSE="debug doc examples icu ipv6 python readline test"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="debug doc examples icu ipv6 python readline static-libs test"
XSTS_HOME="http://www.w3.org/XML/2004/xml-schema-test-suite"
XSTS_NAME_1="xmlschema2002-01-16"
epatch "${FILESDIR}/${P}-xpath-freeing.patch"
epatch "${FILESDIR}/${P}-xpath-freeing2.patch"
+ # Fix some potential problems on reallocation failures
+ epatch "${FILESDIR}/${P}-reallocation-failures.patch"
+
epatch "${FILESDIR}/${P}-disable_static_modules.patch"
+ # Hardening of XPath evaluation
+ epatch "${FILESDIR}/${P}-hardening-xpath.patch"
+
+ # Fix missing error status in XPath evaluation
+ epatch "${FILESDIR}/${P}-error-xpath.patch"
+
# Please do not remove, as else we get references to PORTAGE_TMPDIR
# in /usr/lib/python?.?/site-packages/libxml2mod.la among things.
# We now need to run eautoreconf at the end to prevent maintainer mode.
$(use_with python)
$(use_with readline)
$(use_with readline history)
- $(use_enable ipv6)"
+ $(use_enable ipv6)
+ $(use_enable static-libs static)"
# filter seemingly problematic CFLAGS (#26320)
filter-flags -fprefetch-loop-arrays -funroll-loops
rm -rf "${ED}/usr/share/doc/${PF}/examples"
rm -rf "${ED}/usr/share/doc/${PF}/python/examples"
fi
+
+ if ! use static-libs; then
+ # Remove useless .la files
+ find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed"
+ fi
}
pkg_postinst() {