summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Rostovtsev <tetromino@gentoo.org>2012-09-10 05:24:48 +0000
committerAlexandre Rostovtsev <tetromino@gentoo.org>2012-09-10 05:24:48 +0000
commit810cc620955d6f9218cfed31f527178da01c220e (patch)
tree253f5ecf414b5462515f831a8b76207940716802 /dev-libs/libxslt
parentAdd gnome-3.4.1 meta. (diff)
downloadhistorical-810cc620955d6f9218cfed31f527178da01c220e.tar.gz
historical-810cc620955d6f9218cfed31f527178da01c220e.tar.bz2
historical-810cc620955d6f9218cfed31f527178da01c220e.zip
Ensure special treatment for namespace nodes (CVE-2012-2871) and fix use-after-free errors (CVE-2012-2870); bug #433603, thanks to Paweł Hajdan, Jr. Fix non-posix comparison in configure; bug #420335, thanks to Richard Yao.
Package-Manager: portage-2.2.0_alpha124/cvs/Linux x86_64
Diffstat (limited to 'dev-libs/libxslt')
-rw-r--r--dev-libs/libxslt/ChangeLog17
-rw-r--r--dev-libs/libxslt/Manifest24
-rw-r--r--dev-libs/libxslt/files/0002-Hardening-ofcodecheckingnodetypesinvariousentrypoint.patch590
-rw-r--r--dev-libs/libxslt/files/libxslt-1.1.26-generate-id-crash.patch51
-rw-r--r--dev-libs/libxslt/files/libxslt-1.1.26-node-type-1.patch37
-rw-r--r--dev-libs/libxslt/files/libxslt-1.1.26-node-type-2.patch590
-rw-r--r--dev-libs/libxslt/files/libxslt-1.1.26-node-type-3.patch38
-rw-r--r--dev-libs/libxslt/files/libxslt-1.1.26-pattern-compile-crash.patch209
-rw-r--r--dev-libs/libxslt/files/libxslt-1.1.26-posix-comparison.patch15
-rw-r--r--dev-libs/libxslt/libxslt-1.1.26-r4.ebuild137
10 files changed, 1706 insertions, 2 deletions
diff --git a/dev-libs/libxslt/ChangeLog b/dev-libs/libxslt/ChangeLog
index 5ccd8182242e..321bd34b1833 100644
--- a/dev-libs/libxslt/ChangeLog
+++ b/dev-libs/libxslt/ChangeLog
@@ -1,6 +1,21 @@
# ChangeLog for dev-libs/libxslt
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxslt/ChangeLog,v 1.229 2012/04/26 17:11:48 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxslt/ChangeLog,v 1.230 2012/09/10 05:24:48 tetromino Exp $
+
+*libxslt-1.1.26-r4 (10 Sep 2012)
+
+ 10 Sep 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+ +files/0002-Hardening-ofcodecheckingnodetypesinvariousentrypoint.patch,
+ +libxslt-1.1.26-r4.ebuild, +files/libxslt-1.1.26-generate-id-crash.patch,
+ +files/libxslt-1.1.26-node-type-1.patch,
+ +files/libxslt-1.1.26-node-type-2.patch,
+ +files/libxslt-1.1.26-node-type-3.patch,
+ +files/libxslt-1.1.26-pattern-compile-crash.patch,
+ +files/libxslt-1.1.26-posix-comparison.patch:
+ Ensure special treatment for namespace nodes (CVE-2012-2871) and fix
+ use-after-free errors (CVE-2012-2870); bug #433603, thanks to Paweł Hajdan,
+ Jr. Fix non-posix comparison in configure; bug #420335, thanks to Richard
+ Yao.
26 Apr 2012; Alexis Ballier <aballier@gentoo.org> libxslt-1.1.26-r3.ebuild:
keyword ~amd64-fbsd
diff --git a/dev-libs/libxslt/Manifest b/dev-libs/libxslt/Manifest
index 5f967414160c..f6981bd75016 100644
--- a/dev-libs/libxslt/Manifest
+++ b/dev-libs/libxslt/Manifest
@@ -1,11 +1,33 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX 0002-Hardening-ofcodecheckingnodetypesinvariousentrypoint.patch 20055 SHA256 cbc672841327b0d5bd7bf8f8e1a1d30f3852d495434210fbc199a69a7cdc08c5 SHA512 c41dc3adf91ddc33b26b2d66e9073c63b87eff83c8b7ea36031d19b4efb69adae096752e617fd68e928c91c238fa7639282f5c75ce8702f15ab7192672199bcf WHIRLPOOL 542bd489e1d2d78092fa298c02f297c01acd80c37299b4d7627171bcac7b14d023a195f0aec2506cde1572432ea49850ee4c76a981984eab97830e2ba5cf8da4
AUX libxslt-1.1.23-parallel-install.patch 578 SHA256 9b2fa23d7a4fef60c8acec7e8003bc42f4a4c9c1dbd5e035aa54af3e8ccecd5a SHA512 1a3032f7564e9001bfa7d622e1c538accbe5edd32ddfbb38c7ecc09c361a5bb389c3718b1e36b794bf5204766d66f2ea5f96cb43c9f7e2c0a1ddc3ae2377e640 WHIRLPOOL 27bbd1c4f1a984982b727a8a32742f72b80322af7c3098cf07f11ec681d8d8e32a0519344afe2f96fda5a55ab7793b713c0d5f10b08a5ebd06b32d41f8661cf3
AUX libxslt-1.1.26-disable_static_modules.patch 318 SHA256 6c08da472bd1d48af1aab88619e460ad17f56c49bfaa00ccbfd8acf9212c5e80 SHA512 c54fa2b0edcdadde68f3d63bc8f39404eea7d5b866c1b2b0989c0cb343e25bd78da047434314447d3e5773b2c9e1455bcc82153c83541f12ecf4169919f3187a WHIRLPOOL 12984a243827e5bb25293d760f4d74f493254e5e90b48c6be20928aeae68cbfe71c345868165324af83c685781d0fd1b4e3594347e89964dfa3db5bf1ab58a55
+AUX libxslt-1.1.26-generate-id-crash.patch 1588 SHA256 d7b6c83dbc0635e514b413a2a3b8f8ceb436d54f3e1757c8574f2fcf894255ea SHA512 47146de18ce56cbf5fa39b396a42d9b788ad679bdf1a4cb87195ffe5bf68be5f3241eda59783b42bdecc5319baa247905fec1a9ceb5f5ed901872e4c1fb54e8f WHIRLPOOL 7eab0ec5623c3f23360dced0e50bf7918aace8190679c2f09e95864a3bd76e3bbb9a69622805ef0b9ad4e00559e875cd11e583c7dde1939ec09e918b0c584ba7
AUX libxslt-1.1.26-id-generation.patch 1733 SHA256 19ce8384b8dbe088c7349113e7769c3c735edabe1d54f3182b7f9627eea1532a SHA512 afd544ca75c06dfea3d60545eed8a92f7d56988a1bf01208e4a75b69b45c6c5a75c83eeb24298988c4741e4df90d175feb0fd0029ee4fae85d8679f1affd091f WHIRLPOOL f005d0425213ed11fe824aac2f0c093f4d0f12833e76ef7bfa7ff5cfbefc81eac31f20a5dcce316f1a744f682817312cb75fae55264686327c6dc8a70b4cee31
+AUX libxslt-1.1.26-node-type-1.patch 1155 SHA256 2d16ebf4b82f36e955f10834310ff55ca1bc406f775390f9e4e6ec09f3880a80 SHA512 be15a78cc190adc44e70f2fcc8b7ef8a4a09f6b91fafbbb85b003a19a1c30cbe19289aa821757727785588ad5dd590f58b8933b90f43bfee5320142f96571c16 WHIRLPOOL a1c6c1029cfab7ee50646799e239d202c460cfae982f3859178e4b363b616833ef838c69e050ed913f06f5acec6ab98201bbcce4d5fc7369a10cb8e528dece38
+AUX libxslt-1.1.26-node-type-2.patch 20055 SHA256 cbc672841327b0d5bd7bf8f8e1a1d30f3852d495434210fbc199a69a7cdc08c5 SHA512 c41dc3adf91ddc33b26b2d66e9073c63b87eff83c8b7ea36031d19b4efb69adae096752e617fd68e928c91c238fa7639282f5c75ce8702f15ab7192672199bcf WHIRLPOOL 542bd489e1d2d78092fa298c02f297c01acd80c37299b4d7627171bcac7b14d023a195f0aec2506cde1572432ea49850ee4c76a981984eab97830e2ba5cf8da4
+AUX libxslt-1.1.26-node-type-3.patch 1063 SHA256 1a2958c547c3f7f907f2c5fbf1442f5b98c990fa91edc9b39f9f3bb728cf3a86 SHA512 a0c27b0a1cc41d3ec2f7000635d601eb8e964a960ae30ec11f3c766a62665107c4d164cc80a330d32cbe9824c32bbae6f9f3e23da4c8f9ae212070ee2a026d17 WHIRLPOOL 67200769e95f1f8f6eb615155d562eb0c1fdd015d38b384adc6fbf6f8d14a67fc147a41901f6dd82b0423c559f5cdae0e581f9686ca06a77d625f75123ce28da
+AUX libxslt-1.1.26-pattern-compile-crash.patch 5849 SHA256 7275ca9a9d1c436e37159acccacfd1de4561a076b936daf76f8466d4bd0f1495 SHA512 4df8ad16ba4b0ecfd477e5aa89769d688c52e22a1ac6c0b291db4056ac1453185d904630def63b47fba7ca7627b0b80c2bf129922af9a199298095d46fd73bb3 WHIRLPOOL 2d1ee954e53933f01d4177a06b4ef9f4ed59190dc4cf8986ea5fd6b48ae5205f47340f2d54e39622a9579c51c42e9601a90cfeba3c305c06d1b52859db9e04d6
AUX libxslt-1.1.26-pattern-out-of-bounds-read.patch 797 SHA256 cf5bb2f4a1e95981ebaee4000e736dfe450a9a95639c49333b4f2bc93287c8df SHA512 0962e23eb916d1e68c98a90abcf5705abcc4cdcf36a3cd7d9df4a109c96e175b02e98809944189f48326cc70f2cc3a3904d30a949a1f7cc103b44129ca77cdf9 WHIRLPOOL 3aa693af43f2bd46f956bbfcdb9e8e8fccb9ca591090cfc713b6cd473a86b967680046efeefb441bdb32ab1b3df67cacee92e4cf5f2bb47259a7641add25dd86
+AUX libxslt-1.1.26-posix-comparison.patch 531 SHA256 48647e961a179f498746fc5124e14dbb4eb6bdef9d9f126c4805f68d50a7473d SHA512 30938faf55f3a98d7a9d2ce7930c789803db7ab7cde1ddc1db643a7f75aa6e63a642b41b8987515a287d3ec2e2e755b633989bfab5fc0d83beb4a2f3deb2d6e8 WHIRLPOOL b84e66dbd7414311074cab7b309a5268209ee6d9714b4dbc5b5fcf2040b1d69f1a44cfe7ecf1defa236e7ffb322cca35d9ab94321379b7f42a9260a5c1b8604e
AUX libxslt-1.1.26-undefined.patch 616 SHA256 bcd05d121d9857181037ec5d9740fff51640ee2e4a7c5933c9d65f7ee6011062 SHA512 d68ae238db519f3c3cea1382e7c44702211eb2ef73f42919f5a0dc61ebcb2b9b1c0fd498d5778034024e1ab9e05ebf9c59db2903cc0c8dc1b844f3120feca315 WHIRLPOOL 9fc2d16dc79fa0ae90a5786031e0a6cb23bc58694d9fb330b72ac12b2eb370492cc681f0dc233f372f02c9a29b1aadaeb3bcf757701e7008948d8ac8e204615d
AUX libxslt.m4-libxslt-1.1.26.patch 1421 SHA256 c02cd8437064db0921c08e63245c403dad12410d2997715aa7aa36600bfaa895 SHA512 78cfb6bd823805f660c9d07c4f6f83a87cf2385c48fcb11bff82792101f06b36d08f851089497f0c019f5743f31248cbabe341f78f4ca7e7617c86c4e5a8404a WHIRLPOOL 0b4da6d1ce77e653a6c175fc203f5fecd0c831a018a5063e66e5ff0cc19d9a19d8938b06e4318938a35f665f91442290f267bb3fc86b9268c2455ac9616caeff
DIST libxslt-1.1.26.tar.gz 3401513 SHA256 55dd52b42861f8a02989d701ef716d6280bfa02971e967c285016f99c66e3db1 SHA512 f09aa039d2addd3cf45dfeb3b22fe5e756757e2e801275384342fdfc297acf78b557d310e30262986a1af7825da8f1d66bc0ce9f132e474d4c32e322aa72f11e WHIRLPOOL a71ffc6ec16114277e393de9fe6a6c3476febef2551b537abd013862caa247804f53e82f2de716cdfdce101ebc081e877379c5e3c890ba6e7df4ba3ad67f1d6c
EBUILD libxslt-1.1.26-r2.ebuild 2919 SHA256 b286101edaaafa9e446312d1a32b15b67f7d4bdbbeb68e73c07fd4f738663aeb SHA512 1592011818e99f930b2cf461ce24de1719c872381af5e49c8563c9f8976cfd7936141cd473b1efe536fd5b6b04dbb4fff3b857a8d5b71aea5cf2628c5afa3094 WHIRLPOOL e32df421f636af02b363c382b2c96b61369cda069f092e2d7926ba6ccb0fe644efed06473e2752edd92fb82aa151b1bcdfa2769c0f22cfce4fec5bddbda52153
EBUILD libxslt-1.1.26-r3.ebuild 3029 SHA256 3c9e0635a8fbd38bce60d6aa32a389480952c95b0fa2401fe8a5e52d0e632617 SHA512 c8692b5c796dce6c449f8e9acec0e73adf78c29b01b855003d842ae4376189a800a42df3990e0316de083dc72483723664d660c29eab5e2c4f5263c3e809c6cd WHIRLPOOL 7ab8574e98e5f09447a978df4d3c791969e0b652ea071ca1d37fe43339280fbea2b16c41bb57865bbc8f7e406f1f078189be215b42bae2a2e1f483230188b565
-MISC ChangeLog 27665 SHA256 bcdb1bc00a62b66b8cc4e96c3ec8f577f2e43ac377b5532b2441438a4c00a5e4 SHA512 39db3554fb54ef5e3b1fdc10d8d2e0b5e70bf13db2fc1f7d48e92a0562456b9c4a35c332b48094c8d0a9007dada0d18f9aee70986a1ac1aec3f1f82671a30c9e WHIRLPOOL 597013f2db9fa5c09c5187941653c69bc20d4370e954ecfa010673cdf743c06a996e22982065c14a18dd62c90aecfdbadb71a2f4524f40e81112f5f37298ea04
+EBUILD libxslt-1.1.26-r4.ebuild 3386 SHA256 58ffb40a4a2fa787c727b423818c6f55a6eb725909652c50cee6851831ba930f SHA512 aa40ca783fab1b9f98d7cf7e5037df755e8d901777b7ad05951aab168ef153ea5853e10c2ab00851fa8d36bc683d4ad8d3365f827121d1480ea0ad975ea6ea9d WHIRLPOOL de6d4885bf0f0663b3762428140e84a19ddac187d959de18ab3e1e2f8405f4c965fd8b35c5f66292db15ea3d0a936affff4c21c9ee478a867d220f84d6c655a5
+MISC ChangeLog 28373 SHA256 754edba6d89804b2bdac7973b05217b2f6ce2bfaaca32f4537751b6b53a4621e SHA512 5920dfc213e4594ae2c839fb6a161f97206a6be53907d3c926bf149d9b0e19e0fee86b9ef28d38b10719c283fdd8a1bbe3d236fc98ce206fa1c290f8afcb97a0 WHIRLPOOL b9597830c5cba3cf0c5a9641a0b05e14b8fe6cf4c7cfcfca127352be4fac727b6a6676b5f2ef45b80d02e40961469ae303bb0ef91b1169b2de6422ddba8ab3bd
MISC metadata.xml 158 SHA256 3a7dbca0fdc557de69783e0663e2d76ddab129ea8a19b2d0ef6d3e5d1b947ce1 SHA512 7fbfbd2b3ed1b81867d55648509f778fdbe2091af53727b3426a3c7f453ae7e1663a99fdd2101508b8d6c85b3158459c93551b77a6a394f02d7e11cbc8a5ecf4 WHIRLPOOL 4bcd5662974877d42ebc4361b6eb412bfeea2af7144b436ce7ed152327d554afc321c376625ba0bb85a704b70d86e3c4882dff3573047acddd8ffccf655d4f7e
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQEcBAEBCAAGBQJQTXmlAAoJEJ0WA1zPCt1hF5cIAJtigqp/zVRW5l4P8lTEqBSF
+BD5jna9aWJeG6JRUb73btE3vjoe6dAk9ahIuCloL42xdMp7H96ct5fpBEITH6r0q
+QsiJwcplVb5Mshr3A7mhgK7YHITu9JwC0nGKgbJj6qGs+ApeGG5wbP8b/JjYvSm5
+cBxsY5Se8qpPSIzdUuk3bJALcq8FXA356uLCUvneyPTd2rBXmYX9PD25BwHQmFbr
+sbZtUmy1Rz6RtAe3nyuPUhfKravCBg77bfLdYateQDkcvjY3MpWjSTfRi6CozilP
+yLTQCO+jS+jzP4oAiVlCqpzXNtGPdG6Ozzgk1sWHmGxAvfNxnlVhzs4eols3ytw=
+=2LV9
+-----END PGP SIGNATURE-----
diff --git a/dev-libs/libxslt/files/0002-Hardening-ofcodecheckingnodetypesinvariousentrypoint.patch b/dev-libs/libxslt/files/0002-Hardening-ofcodecheckingnodetypesinvariousentrypoint.patch
new file mode 100644
index 000000000000..d8081b2b829d
--- /dev/null
+++ b/dev-libs/libxslt/files/0002-Hardening-ofcodecheckingnodetypesinvariousentrypoint.patch
@@ -0,0 +1,590 @@
+From 1564b30e994602a95863d9716be83612580a2fed Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 9 Aug 2012 16:18:51 +0800
+Subject: [PATCH] Hardening of code checking node types in various entry point
+
+---
+ libxslt/attributes.c | 5 +++--
+ libxslt/preproc.c | 45 +++++++++++++++++++++++----------------------
+ libxslt/templates.c | 15 ++++++++++-----
+ libxslt/transform.c | 2 +-
+ libxslt/variables.c | 10 +++++-----
+ libxslt/xslt.c | 43 +++++++++++++++++++++++++------------------
+ libxslt/xsltutils.c | 27 +++++++++++++++++++--------
+ 7 files changed, 86 insertions(+), 61 deletions(-)
+
+diff --git a/libxslt/attributes.c b/libxslt/attributes.c
+index ce47df7..11d558b 100644
+--- a/libxslt/attributes.c
++++ b/libxslt/attributes.c
+@@ -293,7 +293,7 @@ xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlNodePtr child;
+ xsltAttrElemPtr attrItems;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL);
+@@ -656,7 +656,8 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
+ xmlNsPtr ns = NULL;
+ xmlAttrPtr attr;
+
+- if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
++ if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
++ (inst->type != XML_ELEMENT_NODE) )
+ return;
+
+ /*
+diff --git a/libxslt/preproc.c b/libxslt/preproc.c
+index f5d265d..4d483ff 100644
+--- a/libxslt/preproc.c
++++ b/libxslt/preproc.c
+@@ -680,7 +680,7 @@ xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ #else
+ xsltStylePreCompPtr comp;
+ #endif
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -788,7 +788,7 @@ xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+ #ifdef XSLT_REFACTORED
+ comp = (xsltStyleItemCopyPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPY);
+@@ -832,7 +832,7 @@ xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ #endif
+ const xmlChar *prop;
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -885,7 +885,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ * <!-- Content: template -->
+ * </xsl:element>
+ */
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1002,7 +1002,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ * <!-- Content: template -->
+ * </xsl:attribute>
+ */
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1122,7 +1122,7 @@ xsltCommentComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1152,7 +1152,7 @@ xsltProcessingInstructionComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1186,7 +1186,7 @@ xsltCopyOfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1233,7 +1233,7 @@ xsltValueOfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ #endif
+ const xmlChar *prop;
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1358,7 +1358,7 @@ xsltWithParamComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1417,7 +1417,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
+ #endif
+ const xmlChar *prop;
+
+- if ((style == NULL) || (cur == NULL))
++ if ((style == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1543,7 +1543,7 @@ xsltApplyImportsComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1573,7 +1573,7 @@ xsltCallTemplateComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1612,7 +1612,7 @@ xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1664,7 +1664,7 @@ xsltChooseComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1695,7 +1695,7 @@ xsltIfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1741,7 +1741,7 @@ xsltWhenComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1787,7 +1787,7 @@ xsltForEachComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1835,7 +1835,7 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1914,7 +1914,7 @@ xsltParamComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -2006,7 +2006,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
+ * the parsing mechanism for all elements in the XSLT namespace.
+ */
+ if (style == NULL) {
+- if (node != NULL)
++ if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
+ node->psvi = NULL;
+ return;
+ }
+@@ -2221,7 +2221,8 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) {
+ * namespace- and local-name of the node, but can evaluate this
+ * using cctxt->style->inode->category;
+ */
+- if (inst->psvi != NULL)
++ if ((inst == NULL) || (inst->type != XML_ELEMENT_NODE) ||
++ (inst->psvi != NULL))
+ return;
+
+ if (IS_XSLT_ELEM(inst)) {
+diff --git a/libxslt/templates.c b/libxslt/templates.c
+index 52bb3cf..169afd9 100644
+--- a/libxslt/templates.c
++++ b/libxslt/templates.c
+@@ -198,7 +198,8 @@ xsltEvalTemplateString(xsltTransformContextPtr ctxt,
+ xmlNodePtr oldInsert, insert = NULL;
+ xmlChar *ret;
+
+- if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
++ if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
++ (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ if (inst->children == NULL)
+@@ -390,7 +391,8 @@ xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst,
+ xmlChar *ret;
+ xmlChar *expr;
+
+- if ((ctxt == NULL) || (inst == NULL) || (name == NULL))
++ if ((ctxt == NULL) || (inst == NULL) || (name == NULL) ||
++ (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ expr = xsltGetNsProp(inst, name, ns);
+@@ -434,7 +436,8 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst,
+ const xmlChar *ret;
+ xmlChar *expr;
+
+- if ((style == NULL) || (inst == NULL) || (name == NULL))
++ if ((style == NULL) || (inst == NULL) || (name == NULL) ||
++ (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ expr = xsltGetNsProp(inst, name, ns);
+@@ -475,7 +478,8 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
+ const xmlChar *value;
+ xmlAttrPtr ret;
+
+- if ((ctxt == NULL) || (attr == NULL) || (target == NULL))
++ if ((ctxt == NULL) || (attr == NULL) || (target == NULL) ||
++ (target->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ if (attr->type != XML_ATTRIBUTE_NODE)
+@@ -632,7 +636,8 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
+ const xmlChar *value;
+ xmlChar *valueAVT;
+
+- if ((ctxt == NULL) || (target == NULL) || (attrs == NULL))
++ if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) ||
++ (target->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ oldInsert = ctxt->insert;
+diff --git a/libxslt/transform.c b/libxslt/transform.c
+index c6df19e..bc6d851 100644
+--- a/libxslt/transform.c
++++ b/libxslt/transform.c
+@@ -777,7 +777,7 @@ xsltCopyTextString(xsltTransformContextPtr ctxt, xmlNodePtr target,
+ #endif
+
+ /*
+- * Play save and reset the merging mechanism for every new
++ * Play safe and reset the merging mechanism for every new
+ * target node.
+ */
+ if ((target == NULL) || (target->children == NULL)) {
+diff --git a/libxslt/variables.c b/libxslt/variables.c
+index cb0d4b0..2d26872 100644
+--- a/libxslt/variables.c
++++ b/libxslt/variables.c
+@@ -1935,7 +1935,7 @@ xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst)
+ the instruction itself. */
+ xsltStackElemPtr param = NULL;
+
+- if ((ctxt == NULL) || (inst == NULL))
++ if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ #ifdef XSLT_REFACTORED
+@@ -1994,7 +1994,7 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur)
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -2056,7 +2056,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -2119,7 +2119,7 @@ xsltParseStylesheetVariable(xsltTransformContextPtr ctxt, xmlNodePtr inst)
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((inst == NULL) || (ctxt == NULL))
++ if ((inst == NULL) || (ctxt == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ comp = inst->psvi;
+@@ -2161,7 +2161,7 @@ xsltParseStylesheetParam(xsltTransformContextPtr ctxt, xmlNodePtr cur)
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((cur == NULL) || (ctxt == NULL))
++ if ((cur == NULL) || (ctxt == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ comp = cur->psvi;
+diff --git a/libxslt/xslt.c b/libxslt/xslt.c
+index 6293bb3..2bc8af5 100644
+--- a/libxslt/xslt.c
++++ b/libxslt/xslt.c
+@@ -1162,9 +1162,9 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
+ xmlChar *element,
+ *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+-
++
+ prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL);
+ if (prop != NULL) {
+ if (style->version != NULL)
+@@ -1377,12 +1377,12 @@ xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur)
+ xmlChar *prop;
+ xsltDecimalFormatPtr format;
+ xsltDecimalFormatPtr iter;
+-
+- if ((cur == NULL) || (style == NULL))
++
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ format = style->decimalFormat;
+-
++
+ prop = xmlGetNsProp(cur, BAD_CAST("name"), NULL);
+ if (prop != NULL) {
+ format = xsltDecimalFormatGetByName(style, prop);
+@@ -1484,7 +1484,7 @@ xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlChar *elements;
+ xmlChar *element, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
+@@ -1558,7 +1558,7 @@ xsltParseStylesheetExtPrefix(xsltStylesheetPtr style, xmlNodePtr cur,
+ xmlChar *prefixes;
+ xmlChar *prefix, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ if (isXsltElem) {
+@@ -1623,7 +1623,7 @@ xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlChar *elements;
+ xmlChar *element, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
+@@ -1696,7 +1696,7 @@ xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur,
+ xmlChar *prefixes;
+ xmlChar *prefix, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return(0);
+
+ if (isXsltElem)
+@@ -4287,7 +4287,7 @@ static int
+ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt,
+ xmlNodePtr node)
+ {
+- if ((cctxt == NULL) || (node == NULL))
++ if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE))
+ return(-1);
+
+ /*
+@@ -4384,7 +4384,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur)
+ if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+ cctxt->inode->extContentHandled = 1;
+ }
+- if (cur == NULL)
++ if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
+ return;
+ /*
+ * This is the content reffered to as a "template".
+@@ -4789,7 +4789,8 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur)
+ */
+ void
+ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+- if ((style == NULL) || (templ == NULL))
++ if ((style == NULL) || (templ == NULL) ||
++ (templ->type == XML_NAMESPACE_DECL))
+ return;
+
+ /*
+@@ -4838,6 +4839,10 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+ void
+ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+ xmlNodePtr cur, delete;
++
++ if ((style == NULL) || (templ == NULL) ||
++ (templ->type == XML_NAMESPACE_DECL)) return;
++
+ /*
+ * This content comes from the stylesheet
+ * For stylesheets, the set of whitespace-preserving
+@@ -5057,7 +5062,7 @@ xsltParseStylesheetKey(xsltStylesheetPtr style, xmlNodePtr key) {
+ xmlChar *name = NULL;
+ xmlChar *nameURI = NULL;
+
+- if ((style == NULL) || (key == NULL))
++ if ((style == NULL) || (key == NULL) || (key->type != XML_ELEMENT_NODE))
+ return;
+
+ /*
+@@ -5147,7 +5152,8 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) {
+ xmlChar *prop;
+ double priority;
+
+- if ((cctxt == NULL) || (templNode == NULL))
++ if ((cctxt == NULL) || (templNode == NULL) ||
++ (templNode->type != XML_ELEMENT_NODE))
+ return;
+
+ /*
+@@ -5308,7 +5314,8 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
+ xmlChar *modeURI = NULL;
+ double priority;
+
+- if (template == NULL)
++ if ((style == NULL) || (template == NULL) ||
++ (template->type != XML_ELEMENT_NODE))
+ return;
+
+ /*
+@@ -5440,7 +5447,7 @@ static xsltStyleItemIncludePtr
+ xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) {
+ xsltStyleItemIncludePtr item;
+
+- if ((cctxt == NULL) || (node == NULL))
++ if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ node->psvi = NULL;
+@@ -5960,7 +5967,7 @@ xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+ {
+ xmlNodePtr cur, start;
+
+- if ((cctxt == NULL) || (node == NULL))
++ if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE))
+ return(-1);
+
+ if (node->children == NULL)
+@@ -6048,7 +6055,7 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) {
+ int templates = 0;
+ #endif
+
+- if (top == NULL)
++ if ((top == NULL) || (top->type != XML_ELEMENT_NODE))
+ return;
+
+ prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL);
+diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
+index 7a4caf0..6a0e8f2 100644
+--- a/libxslt/xsltutils.c
++++ b/libxslt/xsltutils.c
+@@ -91,10 +91,15 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node,
+ if ((node == NULL) || (style == NULL) || (style->dict == NULL))
+ return(NULL);
+
+- prop = node->properties;
+- if (nameSpace == NULL) {
++ if (nameSpace == NULL)
+ return xmlGetProp(node, name);
+- }
++
++ if (node->type == XML_NAMESPACE_DECL)
++ return(NULL);
++ if (node->type == XML_ELEMENT_NODE)
++ prop = node->properties;
++ else
++ prop = NULL;
+ while (prop != NULL) {
+ /*
+ * One need to have
+@@ -131,7 +136,7 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node,
+ attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
+ if ((attrDecl == NULL) && (doc->extSubset != NULL))
+ attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
+-
++
+ if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
+ /*
+ * The DTD declaration only allows a prefix search
+@@ -173,7 +178,15 @@ xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+ if (node == NULL)
+ return(NULL);
+
+- prop = node->properties;
++ if (nameSpace == NULL)
++ return xmlGetProp(node, name);
++
++ if (node->type == XML_NAMESPACE_DECL)
++ return(NULL);
++ if (node->type == XML_ELEMENT_NODE)
++ prop = node->properties;
++ else
++ prop = NULL;
+ /*
+ * TODO: Substitute xmlGetProp() for xmlGetNsProp(), since the former
+ * is not namespace-aware and will return an attribute with equal
+@@ -183,8 +196,6 @@ xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+ * So this would return "myName" even if an attribute @name
+ * in the XSLT was requested.
+ */
+- if (nameSpace == NULL)
+- return(xmlGetProp(node, name));
+ while (prop != NULL) {
+ /*
+ * One need to have
+@@ -217,7 +228,7 @@ xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+ attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
+ if ((attrDecl == NULL) && (doc->extSubset != NULL))
+ attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
+-
++
+ if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
+ /*
+ * The DTD declaration only allows a prefix search
+--
+1.7.12
+
diff --git a/dev-libs/libxslt/files/libxslt-1.1.26-generate-id-crash.patch b/dev-libs/libxslt/files/libxslt-1.1.26-generate-id-crash.patch
new file mode 100644
index 000000000000..c0882e20ddc4
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.26-generate-id-crash.patch
@@ -0,0 +1,51 @@
+From 4da0f7e207f14a03daad4663865c285eb27f93e9 Mon Sep 17 00:00:00 2001
+From: Chris Evans <cevans@chromium.org>
+Date: Mon, 3 Sep 2012 18:16:44 +0800
+Subject: [PATCH] Avoid a heap use after free error
+
+For https://code.google.com/p/chromium/issues/detail?id=140368
+---
+ libxslt/functions.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libxslt/functions.c b/libxslt/functions.c
+index 5a8eb79..fe2f1ca 100644
+--- a/libxslt/functions.c
++++ b/libxslt/functions.c
+@@ -660,6 +660,7 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
+ void
+ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
+ xmlNodePtr cur = NULL;
++ xmlXPathObjectPtr obj = NULL;
+ long val;
+ xmlChar str[30];
+ xmlDocPtr doc;
+@@ -667,7 +668,6 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
+ if (nargs == 0) {
+ cur = ctxt->context->node;
+ } else if (nargs == 1) {
+- xmlXPathObjectPtr obj;
+ xmlNodeSetPtr nodelist;
+ int i, ret;
+
+@@ -690,7 +690,6 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
+ if (ret == -1)
+ cur = nodelist->nodeTab[i];
+ }
+- xmlXPathFreeObject(obj);
+ } else {
+ xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
+ "generate-id() : invalid number of args %d\n", nargs);
+@@ -713,6 +712,9 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
+
+ }
+
++ if (obj)
++ xmlXPathFreeObject(obj);
++
+ val = (long)((char *)cur - (char *)doc);
+ if (val >= 0) {
+ sprintf((char *)str, "idp%ld", val);
+--
+1.7.12
+
diff --git a/dev-libs/libxslt/files/libxslt-1.1.26-node-type-1.patch b/dev-libs/libxslt/files/libxslt-1.1.26-node-type-1.patch
new file mode 100644
index 000000000000..c20770c4fc91
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.26-node-type-1.patch
@@ -0,0 +1,37 @@
+From 937ba2a3eb42d288f53c8adc211bd1122869f0bf Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Wed, 8 Aug 2012 15:31:05 +0800
+Subject: [PATCH] Fix default template processing on namespace nodes
+
+---
+ libxslt/transform.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/libxslt/transform.c b/libxslt/transform.c
+index 53eefcc..c6df19e 100644
+--- a/libxslt/transform.c
++++ b/libxslt/transform.c
+@@ -4895,7 +4895,10 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
+ list = xmlXPathNodeSetCreate(NULL);
+ if (list == NULL)
+ goto error;
+- cur = node->children;
++ if (node->type != XML_NAMESPACE_DECL)
++ cur = node->children;
++ else
++ cur = NULL;
+ while (cur != NULL) {
+ switch (cur->type) {
+ case XML_TEXT_NODE:
+@@ -4944,6 +4947,8 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
+ if (cur->prev != NULL)
+ cur->prev->next = cur->next;
+ break;
++ case XML_NAMESPACE_DECL:
++ break;
+ default:
+ #ifdef WITH_XSLT_DEBUG_PROCESS
+ XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
+--
+1.7.12
+
diff --git a/dev-libs/libxslt/files/libxslt-1.1.26-node-type-2.patch b/dev-libs/libxslt/files/libxslt-1.1.26-node-type-2.patch
new file mode 100644
index 000000000000..d8081b2b829d
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.26-node-type-2.patch
@@ -0,0 +1,590 @@
+From 1564b30e994602a95863d9716be83612580a2fed Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 9 Aug 2012 16:18:51 +0800
+Subject: [PATCH] Hardening of code checking node types in various entry point
+
+---
+ libxslt/attributes.c | 5 +++--
+ libxslt/preproc.c | 45 +++++++++++++++++++++++----------------------
+ libxslt/templates.c | 15 ++++++++++-----
+ libxslt/transform.c | 2 +-
+ libxslt/variables.c | 10 +++++-----
+ libxslt/xslt.c | 43 +++++++++++++++++++++++++------------------
+ libxslt/xsltutils.c | 27 +++++++++++++++++++--------
+ 7 files changed, 86 insertions(+), 61 deletions(-)
+
+diff --git a/libxslt/attributes.c b/libxslt/attributes.c
+index ce47df7..11d558b 100644
+--- a/libxslt/attributes.c
++++ b/libxslt/attributes.c
+@@ -293,7 +293,7 @@ xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlNodePtr child;
+ xsltAttrElemPtr attrItems;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL);
+@@ -656,7 +656,8 @@ xsltAttributeInternal(xsltTransformContextPtr ctxt,
+ xmlNsPtr ns = NULL;
+ xmlAttrPtr attr;
+
+- if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
++ if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
++ (inst->type != XML_ELEMENT_NODE) )
+ return;
+
+ /*
+diff --git a/libxslt/preproc.c b/libxslt/preproc.c
+index f5d265d..4d483ff 100644
+--- a/libxslt/preproc.c
++++ b/libxslt/preproc.c
+@@ -680,7 +680,7 @@ xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ #else
+ xsltStylePreCompPtr comp;
+ #endif
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -788,7 +788,7 @@ xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+ #ifdef XSLT_REFACTORED
+ comp = (xsltStyleItemCopyPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPY);
+@@ -832,7 +832,7 @@ xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ #endif
+ const xmlChar *prop;
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -885,7 +885,7 @@ xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ * <!-- Content: template -->
+ * </xsl:element>
+ */
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1002,7 +1002,7 @@ xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ * <!-- Content: template -->
+ * </xsl:attribute>
+ */
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1122,7 +1122,7 @@ xsltCommentComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1152,7 +1152,7 @@ xsltProcessingInstructionComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1186,7 +1186,7 @@ xsltCopyOfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1233,7 +1233,7 @@ xsltValueOfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ #endif
+ const xmlChar *prop;
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1358,7 +1358,7 @@ xsltWithParamComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1417,7 +1417,7 @@ xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) {
+ #endif
+ const xmlChar *prop;
+
+- if ((style == NULL) || (cur == NULL))
++ if ((style == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1543,7 +1543,7 @@ xsltApplyImportsComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1573,7 +1573,7 @@ xsltCallTemplateComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1612,7 +1612,7 @@ xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1664,7 +1664,7 @@ xsltChooseComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1695,7 +1695,7 @@ xsltIfComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1741,7 +1741,7 @@ xsltWhenComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1787,7 +1787,7 @@ xsltForEachComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1835,7 +1835,7 @@ xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -1914,7 +1914,7 @@ xsltParamComp(xsltStylesheetPtr style, xmlNodePtr inst) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -2006,7 +2006,7 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) {
+ * the parsing mechanism for all elements in the XSLT namespace.
+ */
+ if (style == NULL) {
+- if (node != NULL)
++ if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
+ node->psvi = NULL;
+ return;
+ }
+@@ -2221,7 +2221,8 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) {
+ * namespace- and local-name of the node, but can evaluate this
+ * using cctxt->style->inode->category;
+ */
+- if (inst->psvi != NULL)
++ if ((inst == NULL) || (inst->type != XML_ELEMENT_NODE) ||
++ (inst->psvi != NULL))
+ return;
+
+ if (IS_XSLT_ELEM(inst)) {
+diff --git a/libxslt/templates.c b/libxslt/templates.c
+index 52bb3cf..169afd9 100644
+--- a/libxslt/templates.c
++++ b/libxslt/templates.c
+@@ -198,7 +198,8 @@ xsltEvalTemplateString(xsltTransformContextPtr ctxt,
+ xmlNodePtr oldInsert, insert = NULL;
+ xmlChar *ret;
+
+- if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
++ if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
++ (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ if (inst->children == NULL)
+@@ -390,7 +391,8 @@ xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst,
+ xmlChar *ret;
+ xmlChar *expr;
+
+- if ((ctxt == NULL) || (inst == NULL) || (name == NULL))
++ if ((ctxt == NULL) || (inst == NULL) || (name == NULL) ||
++ (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ expr = xsltGetNsProp(inst, name, ns);
+@@ -434,7 +436,8 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst,
+ const xmlChar *ret;
+ xmlChar *expr;
+
+- if ((style == NULL) || (inst == NULL) || (name == NULL))
++ if ((style == NULL) || (inst == NULL) || (name == NULL) ||
++ (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ expr = xsltGetNsProp(inst, name, ns);
+@@ -475,7 +478,8 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
+ const xmlChar *value;
+ xmlAttrPtr ret;
+
+- if ((ctxt == NULL) || (attr == NULL) || (target == NULL))
++ if ((ctxt == NULL) || (attr == NULL) || (target == NULL) ||
++ (target->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ if (attr->type != XML_ATTRIBUTE_NODE)
+@@ -632,7 +636,8 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
+ const xmlChar *value;
+ xmlChar *valueAVT;
+
+- if ((ctxt == NULL) || (target == NULL) || (attrs == NULL))
++ if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) ||
++ (target->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ oldInsert = ctxt->insert;
+diff --git a/libxslt/transform.c b/libxslt/transform.c
+index c6df19e..bc6d851 100644
+--- a/libxslt/transform.c
++++ b/libxslt/transform.c
+@@ -777,7 +777,7 @@ xsltCopyTextString(xsltTransformContextPtr ctxt, xmlNodePtr target,
+ #endif
+
+ /*
+- * Play save and reset the merging mechanism for every new
++ * Play safe and reset the merging mechanism for every new
+ * target node.
+ */
+ if ((target == NULL) || (target->children == NULL)) {
+diff --git a/libxslt/variables.c b/libxslt/variables.c
+index cb0d4b0..2d26872 100644
+--- a/libxslt/variables.c
++++ b/libxslt/variables.c
+@@ -1935,7 +1935,7 @@ xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst)
+ the instruction itself. */
+ xsltStackElemPtr param = NULL;
+
+- if ((ctxt == NULL) || (inst == NULL))
++ if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ #ifdef XSLT_REFACTORED
+@@ -1994,7 +1994,7 @@ xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur)
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -2056,7 +2056,7 @@ xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ #ifdef XSLT_REFACTORED
+@@ -2119,7 +2119,7 @@ xsltParseStylesheetVariable(xsltTransformContextPtr ctxt, xmlNodePtr inst)
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((inst == NULL) || (ctxt == NULL))
++ if ((inst == NULL) || (ctxt == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+ comp = inst->psvi;
+@@ -2161,7 +2161,7 @@ xsltParseStylesheetParam(xsltTransformContextPtr ctxt, xmlNodePtr cur)
+ xsltStylePreCompPtr comp;
+ #endif
+
+- if ((cur == NULL) || (ctxt == NULL))
++ if ((cur == NULL) || (ctxt == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ comp = cur->psvi;
+diff --git a/libxslt/xslt.c b/libxslt/xslt.c
+index 6293bb3..2bc8af5 100644
+--- a/libxslt/xslt.c
++++ b/libxslt/xslt.c
+@@ -1162,9 +1162,9 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
+ xmlChar *element,
+ *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+-
++
+ prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL);
+ if (prop != NULL) {
+ if (style->version != NULL)
+@@ -1377,12 +1377,12 @@ xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur)
+ xmlChar *prop;
+ xsltDecimalFormatPtr format;
+ xsltDecimalFormatPtr iter;
+-
+- if ((cur == NULL) || (style == NULL))
++
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ format = style->decimalFormat;
+-
++
+ prop = xmlGetNsProp(cur, BAD_CAST("name"), NULL);
+ if (prop != NULL) {
+ format = xsltDecimalFormatGetByName(style, prop);
+@@ -1484,7 +1484,7 @@ xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlChar *elements;
+ xmlChar *element, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
+@@ -1558,7 +1558,7 @@ xsltParseStylesheetExtPrefix(xsltStylesheetPtr style, xmlNodePtr cur,
+ xmlChar *prefixes;
+ xmlChar *prefix, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ if (isXsltElem) {
+@@ -1623,7 +1623,7 @@ xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur) {
+ xmlChar *elements;
+ xmlChar *element, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return;
+
+ elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL);
+@@ -1696,7 +1696,7 @@ xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur,
+ xmlChar *prefixes;
+ xmlChar *prefix, *end;
+
+- if ((cur == NULL) || (style == NULL))
++ if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
+ return(0);
+
+ if (isXsltElem)
+@@ -4287,7 +4287,7 @@ static int
+ xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt,
+ xmlNodePtr node)
+ {
+- if ((cctxt == NULL) || (node == NULL))
++ if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE))
+ return(-1);
+
+ /*
+@@ -4384,7 +4384,7 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur)
+ if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) {
+ cctxt->inode->extContentHandled = 1;
+ }
+- if (cur == NULL)
++ if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
+ return;
+ /*
+ * This is the content reffered to as a "template".
+@@ -4789,7 +4789,8 @@ xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur)
+ */
+ void
+ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+- if ((style == NULL) || (templ == NULL))
++ if ((style == NULL) || (templ == NULL) ||
++ (templ->type == XML_NAMESPACE_DECL))
+ return;
+
+ /*
+@@ -4838,6 +4839,10 @@ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+ void
+ xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) {
+ xmlNodePtr cur, delete;
++
++ if ((style == NULL) || (templ == NULL) ||
++ (templ->type == XML_NAMESPACE_DECL)) return;
++
+ /*
+ * This content comes from the stylesheet
+ * For stylesheets, the set of whitespace-preserving
+@@ -5057,7 +5062,7 @@ xsltParseStylesheetKey(xsltStylesheetPtr style, xmlNodePtr key) {
+ xmlChar *name = NULL;
+ xmlChar *nameURI = NULL;
+
+- if ((style == NULL) || (key == NULL))
++ if ((style == NULL) || (key == NULL) || (key->type != XML_ELEMENT_NODE))
+ return;
+
+ /*
+@@ -5147,7 +5152,8 @@ xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) {
+ xmlChar *prop;
+ double priority;
+
+- if ((cctxt == NULL) || (templNode == NULL))
++ if ((cctxt == NULL) || (templNode == NULL) ||
++ (templNode->type != XML_ELEMENT_NODE))
+ return;
+
+ /*
+@@ -5308,7 +5314,8 @@ xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) {
+ xmlChar *modeURI = NULL;
+ double priority;
+
+- if (template == NULL)
++ if ((style == NULL) || (template == NULL) ||
++ (template->type != XML_ELEMENT_NODE))
+ return;
+
+ /*
+@@ -5440,7 +5447,7 @@ static xsltStyleItemIncludePtr
+ xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) {
+ xsltStyleItemIncludePtr item;
+
+- if ((cctxt == NULL) || (node == NULL))
++ if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE))
+ return(NULL);
+
+ node->psvi = NULL;
+@@ -5960,7 +5967,7 @@ xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node)
+ {
+ xmlNodePtr cur, start;
+
+- if ((cctxt == NULL) || (node == NULL))
++ if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE))
+ return(-1);
+
+ if (node->children == NULL)
+@@ -6048,7 +6055,7 @@ xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) {
+ int templates = 0;
+ #endif
+
+- if (top == NULL)
++ if ((top == NULL) || (top->type != XML_ELEMENT_NODE))
+ return;
+
+ prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL);
+diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
+index 7a4caf0..6a0e8f2 100644
+--- a/libxslt/xsltutils.c
++++ b/libxslt/xsltutils.c
+@@ -91,10 +91,15 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node,
+ if ((node == NULL) || (style == NULL) || (style->dict == NULL))
+ return(NULL);
+
+- prop = node->properties;
+- if (nameSpace == NULL) {
++ if (nameSpace == NULL)
+ return xmlGetProp(node, name);
+- }
++
++ if (node->type == XML_NAMESPACE_DECL)
++ return(NULL);
++ if (node->type == XML_ELEMENT_NODE)
++ prop = node->properties;
++ else
++ prop = NULL;
+ while (prop != NULL) {
+ /*
+ * One need to have
+@@ -131,7 +136,7 @@ xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node,
+ attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
+ if ((attrDecl == NULL) && (doc->extSubset != NULL))
+ attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
+-
++
+ if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
+ /*
+ * The DTD declaration only allows a prefix search
+@@ -173,7 +178,15 @@ xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+ if (node == NULL)
+ return(NULL);
+
+- prop = node->properties;
++ if (nameSpace == NULL)
++ return xmlGetProp(node, name);
++
++ if (node->type == XML_NAMESPACE_DECL)
++ return(NULL);
++ if (node->type == XML_ELEMENT_NODE)
++ prop = node->properties;
++ else
++ prop = NULL;
+ /*
+ * TODO: Substitute xmlGetProp() for xmlGetNsProp(), since the former
+ * is not namespace-aware and will return an attribute with equal
+@@ -183,8 +196,6 @@ xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+ * So this would return "myName" even if an attribute @name
+ * in the XSLT was requested.
+ */
+- if (nameSpace == NULL)
+- return(xmlGetProp(node, name));
+ while (prop != NULL) {
+ /*
+ * One need to have
+@@ -217,7 +228,7 @@ xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+ attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name);
+ if ((attrDecl == NULL) && (doc->extSubset != NULL))
+ attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name);
+-
++
+ if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) {
+ /*
+ * The DTD declaration only allows a prefix search
+--
+1.7.12
+
diff --git a/dev-libs/libxslt/files/libxslt-1.1.26-node-type-3.patch b/dev-libs/libxslt/files/libxslt-1.1.26-node-type-3.patch
new file mode 100644
index 000000000000..9f8cd118db0f
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.26-node-type-3.patch
@@ -0,0 +1,38 @@
+From 24653072221e76d2f1f06aa71225229b532f8946 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 16 Aug 2012 15:51:35 +0800
+Subject: [PATCH] Hardening of code checking node types in EXSLT
+
+---
+ libexslt/functions.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libexslt/functions.c b/libexslt/functions.c
+index 13fd06e..4c68cea 100644
+--- a/libexslt/functions.c
++++ b/libexslt/functions.c
+@@ -459,10 +459,9 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
+ xmlHashTablePtr data;
+ exsltFuncFunctionData *func;
+
+- if ((style == NULL) || (inst == NULL))
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+ return;
+
+-
+ {
+ xmlChar *qname;
+
+@@ -546,6 +545,9 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
+ xmlChar *sel;
+ exsltFuncResultPreComp *ret;
+
++ if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
++ return (NULL);
++
+ /*
+ * "Validity" checking
+ */
+--
+1.7.12
+
diff --git a/dev-libs/libxslt/files/libxslt-1.1.26-pattern-compile-crash.patch b/dev-libs/libxslt/files/libxslt-1.1.26-pattern-compile-crash.patch
new file mode 100644
index 000000000000..218b945bc990
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.26-pattern-compile-crash.patch
@@ -0,0 +1,209 @@
+From 8566ab4a10158d195adb5f1f61afe1ee8bfebd12 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veillard@redhat.com>
+Date: Thu, 9 Aug 2012 15:31:07 +0800
+Subject: [PATCH] Cleanup of the pattern compilation code
+
+Avoid potential crashes and memory leaks
+---
+ libxslt/pattern.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 47 insertions(+), 6 deletions(-)
+
+diff --git a/libxslt/pattern.c b/libxslt/pattern.c
+index 1155b54..a6140cb 100644
+--- a/libxslt/pattern.c
++++ b/libxslt/pattern.c
+@@ -303,6 +303,10 @@ xsltCompMatchAdd(xsltParserContextPtr ctxt, xsltCompMatchPtr comp,
+ "xsltCompMatchAdd: memory re-allocation failure.\n");
+ if (ctxt->style != NULL)
+ ctxt->style->errors++;
++ if (value)
++ xmlFree(value);
++ if (value2)
++ xmlFree(value2);
+ return (-1);
+ }
+ comp->maxStep *= 2;
+@@ -1384,17 +1388,22 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
+ NEXT;
+ SKIP_BLANKS;
+ lit = xsltScanLiteral(ctxt);
+- if (ctxt->error)
++ if (ctxt->error) {
++ xsltTransformError(NULL, NULL, NULL,
++ "xsltCompileIdKeyPattern : Literal expected\n");
+ return;
++ }
+ SKIP_BLANKS;
+ if (CUR != ')') {
+ xsltTransformError(NULL, NULL, NULL,
+ "xsltCompileIdKeyPattern : ) expected\n");
++ xmlFree(lit);
+ ctxt->error = 1;
+ return;
+ }
+ NEXT;
+ PUSH(XSLT_OP_ID, lit, NULL, novar);
++ lit = NULL;
+ } else if ((aid) && (xmlStrEqual(name, (const xmlChar *)"key"))) {
+ if (axis != 0) {
+ xsltTransformError(NULL, NULL, NULL,
+@@ -1405,8 +1414,11 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
+ NEXT;
+ SKIP_BLANKS;
+ lit = xsltScanLiteral(ctxt);
+- if (ctxt->error)
++ if (ctxt->error) {
++ xsltTransformError(NULL, NULL, NULL,
++ "xsltCompileIdKeyPattern : Literal expected\n");
+ return;
++ }
+ SKIP_BLANKS;
+ if (CUR != ',') {
+ xsltTransformError(NULL, NULL, NULL,
+@@ -1417,25 +1429,36 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
+ NEXT;
+ SKIP_BLANKS;
+ lit2 = xsltScanLiteral(ctxt);
+- if (ctxt->error)
++ if (ctxt->error) {
++ xsltTransformError(NULL, NULL, NULL,
++ "xsltCompileIdKeyPattern : Literal expected\n");
++ xmlFree(lit);
+ return;
++ }
+ SKIP_BLANKS;
+ if (CUR != ')') {
+ xsltTransformError(NULL, NULL, NULL,
+ "xsltCompileIdKeyPattern : ) expected\n");
++ xmlFree(lit);
++ xmlFree(lit2);
+ ctxt->error = 1;
+ return;
+ }
+ NEXT;
+ /* URGENT TODO: support namespace in keys */
+ PUSH(XSLT_OP_KEY, lit, lit2, novar);
++ lit = NULL;
++ lit2 = NULL;
+ } else if (xmlStrEqual(name, (const xmlChar *)"processing-instruction")) {
+ NEXT;
+ SKIP_BLANKS;
+ if (CUR != ')') {
+ lit = xsltScanLiteral(ctxt);
+- if (ctxt->error)
++ if (ctxt->error) {
++ xsltTransformError(NULL, NULL, NULL,
++ "xsltCompileIdKeyPattern : Literal expected\n");
+ return;
++ }
+ SKIP_BLANKS;
+ if (CUR != ')') {
+ xsltTransformError(NULL, NULL, NULL,
+@@ -1446,6 +1469,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
+ }
+ NEXT;
+ PUSH(XSLT_OP_PI, lit, NULL, novar);
++ lit = NULL;
+ } else if (xmlStrEqual(name, (const xmlChar *)"text")) {
+ NEXT;
+ SKIP_BLANKS;
+@@ -1496,8 +1520,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
+ return;
+ }
+ error:
+- if (name != NULL)
+- xmlFree(name);
++ return;
+ }
+
+ /**
+@@ -1560,6 +1583,8 @@ parse_node_test:
+ SKIP_BLANKS;
+ if (CUR == '(') {
+ xsltCompileIdKeyPattern(ctxt, token, 0, novar, axis);
++ xmlFree(token);
++ token = NULL;
+ if (ctxt->error)
+ goto error;
+ } else if (CUR == ':') {
+@@ -1578,20 +1603,24 @@ parse_node_test:
+ "xsltCompileStepPattern : no namespace bound to prefix %s\n",
+ prefix);
+ xmlFree(prefix);
++ prefix=NULL;
+ ctxt->error = 1;
+ goto error;
+ } else {
+ URL = xmlStrdup(ns->href);
+ }
+ xmlFree(prefix);
++ prefix=NULL;
+ if (token == NULL) {
+ if (CUR == '*') {
+ NEXT;
+ if (axis == AXIS_ATTRIBUTE) {
+ PUSH(XSLT_OP_ATTR, NULL, URL, novar);
++ URL = NULL;
+ }
+ else {
+ PUSH(XSLT_OP_NS, URL, NULL, novar);
++ URL = NULL;
+ }
+ } else {
+ xsltTransformError(NULL, NULL, NULL,
+@@ -1602,9 +1631,13 @@ parse_node_test:
+ } else {
+ if (axis == AXIS_ATTRIBUTE) {
+ PUSH(XSLT_OP_ATTR, token, URL, novar);
++ token = NULL;
++ URL = NULL;
+ }
+ else {
+ PUSH(XSLT_OP_ELEM, token, URL, novar);
++ token = NULL;
++ URL = NULL;
+ }
+ }
+ } else {
+@@ -1626,6 +1659,7 @@ parse_node_test:
+ goto error;
+ }
+ xmlFree(token);
++ token = NULL;
+ SKIP_BLANKS;
+ token = xsltScanNCName(ctxt);
+ goto parse_node_test;
+@@ -1640,9 +1674,13 @@ parse_node_test:
+ URL = xmlStrdup(URI);
+ if (axis == AXIS_ATTRIBUTE) {
+ PUSH(XSLT_OP_ATTR, token, URL, novar);
++ token = NULL;
++ URL = NULL;
+ }
+ else {
+ PUSH(XSLT_OP_ELEM, token, URL, novar);
++ token = NULL;
++ URL = NULL;
+ }
+ }
+ parse_predicate:
+@@ -1682,6 +1720,7 @@ parse_predicate:
+ }
+ ret = xmlStrndup(q, CUR_PTR - q);
+ PUSH(XSLT_OP_PREDICATE, ret, NULL, novar);
++ ret = NULL;
+ /* push the predicate lower than local test */
+ SWAP();
+ NEXT;
+@@ -1790,6 +1829,8 @@ xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) {
+ SKIP_BLANKS;
+ if ((CUR == '(') && !xmlXPathIsNodeType(name)) {
+ xsltCompileIdKeyPattern(ctxt, name, 1, novar, 0);
++ xmlFree(name);
++ name = NULL;
+ if ((CUR == '/') && (NXT(1) == '/')) {
+ PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar);
+ NEXT;
+--
+1.7.12
+
diff --git a/dev-libs/libxslt/files/libxslt-1.1.26-posix-comparison.patch b/dev-libs/libxslt/files/libxslt-1.1.26-posix-comparison.patch
new file mode 100644
index 000000000000..dbfd415a8e8a
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.26-posix-comparison.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/show_bug.cgi?id=420335
+
+diff --git a/configure.in b/configure.in
+index 756003d..46e8e8f 100644
+--- a/configure.in
++++ b/configure.in
+@@ -130,7 +130,7 @@ dnl
+ VERSION_SCRIPT_FLAGS=
+ $(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \
+ VERSION_SCRIPT_FLAGS=-Wl,--version-script=
+-test "`uname`" == "SunOS" && \
++test "`uname`" = "SunOS" && \
+ VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
+ AC_SUBST(VERSION_SCRIPT_FLAGS)
+ AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
diff --git a/dev-libs/libxslt/libxslt-1.1.26-r4.ebuild b/dev-libs/libxslt/libxslt-1.1.26-r4.ebuild
new file mode 100644
index 000000000000..920eba70946b
--- /dev/null
+++ b/dev-libs/libxslt/libxslt-1.1.26-r4.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxslt/libxslt-1.1.26-r4.ebuild,v 1.1 2012/09/10 05:24:48 tetromino Exp $
+
+EAPI="4"
+PYTHON_DEPEND="python? 2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.* *-jython *-pypy-*"
+
+inherit autotools eutils python toolchain-funcs
+
+DESCRIPTION="XSLT libraries and tools"
+HOMEPAGE="http://www.xmlsoft.org/"
+SRC_URI="ftp://xmlsoft.org/${PN}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="crypt debug python static-libs"
+
+DEPEND=">=dev-libs/libxml2-2.6.27:2
+ crypt? ( >=dev-libs/libgcrypt-1.1.42 )"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+ if use python; then
+ python_pkg_setup
+ fi
+ DOCS="AUTHORS ChangeLog FEATURES NEWS README TODO"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/libxslt.m4-${P}.patch \
+ "${FILESDIR}"/${PN}-1.1.23-parallel-install.patch \
+ "${FILESDIR}"/${P}-undefined.patch \
+ "${FILESDIR}"/${P}-disable_static_modules.patch
+
+ # Python bindings are built/tested/installed manually.
+ sed -e "s/@PYTHON_SUBDIR@//" -i Makefile.am || die "sed failed"
+
+ # Fix generate-id() to not expose object addresses, bug #358615
+ epatch "${FILESDIR}/${P}-id-generation.patch"
+
+ # Fix off-by-one in xsltCompilePatternInternal, bug #402861
+ epatch "${FILESDIR}/${P}-pattern-out-of-bounds-read.patch"
+
+ # Namespace nodes require special treatment, bug #433603
+ epatch "${FILESDIR}/${P}-node-type-"{1,2,3}.patch
+
+ # Use-after-free errors, bug #433603
+ epatch "${FILESDIR}/${P}-pattern-compile-crash.patch"
+ epatch "${FILESDIR}/${P}-generate-id-crash.patch"
+
+ # Build fix for freebsd, bug #420335
+ epatch "${FILESDIR}/${P}-posix-comparison.patch"
+
+ eautoreconf
+ epunt_cxx
+}
+
+src_configure() {
+ # libgcrypt is missing pkg-config file, so fixing cross-compile
+ # here. see bug 267503.
+ if tc-is-cross-compiler; then
+ export LIBGCRYPT_CONFIG="${SYSROOT}/usr/bin/libgcrypt-config"
+ fi
+
+ econf \
+ --disable-dependency-tracking \
+ --with-html-dir=/usr/share/doc/${PF} \
+ --with-html-subdir=html \
+ $(use_with crypt crypto) \
+ $(use_with python) \
+ $(use_with debug) \
+ $(use_with debug mem-debug) \
+ $(use_enable static-libs static)
+}
+
+src_compile() {
+ default
+
+ if use python; then
+ python_copy_sources python
+ building() {
+ emake PYTHON_INCLUDES="$(python_get_includedir)" \
+ PYTHON_SITE_PACKAGES="$(python_get_sitedir)" \
+ PYTHON_VERSION="$(python_get_version)"
+ }
+ python_execute_function -s --source-dir python building
+ fi
+}
+
+src_test() {
+ default
+
+ if use python; then
+ testing() {
+ emake test
+ }
+ python_execute_function -s --source-dir python testing
+ fi
+}
+
+src_install() {
+ default
+
+ if use python; then
+ installation() {
+ emake DESTDIR="${D}" \
+ PYTHON_SITE_PACKAGES="$(python_get_sitedir)" \
+ install
+ }
+ python_execute_function -s --source-dir python installation
+
+ python_clean_installation_image
+ fi
+
+ mv -vf "${ED}"/usr/share/doc/${PN}-python-${PV} \
+ "${ED}"/usr/share/doc/${PF}/python
+
+ if ! use static-libs; then
+ # Remove useless .la files
+ find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed"
+ fi
+}
+
+pkg_postinst() {
+ if use python; then
+ python_mod_optimize libxslt.py
+ fi
+}
+
+pkg_postrm() {
+ if use python; then
+ python_mod_cleanup libxslt.py
+ fi
+}