nokogiri-xmlsec1 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/Guardfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +133 -0
- data/Rakefile +30 -0
- data/dependencies.yml +3 -0
- data/ext/nokogiri_ext_xmlsec/extconf.rb +489 -0
- data/ext/nokogiri_ext_xmlsec/init.c +46 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_decrypt_with_key.c +124 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_encrypt_with_key.c +182 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_helpers_set_attribute_id.c +43 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_init.c +32 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_sign_certificate.c +104 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_sign_rsa.c +95 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_verify_signature_certificates.c +96 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_verify_signature_named_keys.c +106 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_verify_signature_rsa.c +56 -0
- data/ext/nokogiri_ext_xmlsec/shutdown.c +12 -0
- data/ext/nokogiri_ext_xmlsec/xmlsecrb.h +39 -0
- data/lib/nokogiri-xmlsec.rb +1 -0
- data/lib/xmlsec.rb +110 -0
- data/lib/xmlsec/version.rb +3 -0
- data/nokogiri-xmlsec1.gemspec +46 -0
- data/ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch +265 -0
- data/ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch +102 -0
- data/ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch +26 -0
- data/ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch +26 -0
- data/ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch +158 -0
- data/ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch +78 -0
- data/ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch +480 -0
- data/ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch +315 -0
- data/ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch +37 -0
- data/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch +2006 -0
- data/ports/patches/libxml2/0011-Do-not-fetch-external-parameter-entities.patch +39 -0
- data/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch +222 -0
- data/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch +53 -0
- data/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch +60 -0
- data/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch +42 -0
- data/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch +164 -0
- data/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch +587 -0
- data/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch +80 -0
- data/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch +185 -0
- data/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch +126 -0
- data/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch +25 -0
- data/ports/patches/libxslt/0014-Fix-for-bug-436589.patch +43 -0
- data/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch +41 -0
- data/ports/patches/xmlsec1/.keep +0 -0
- data/spec/fixtures/cert/server.crt +14 -0
- data/spec/fixtures/cert/server.csr +11 -0
- data/spec/fixtures/cert/server.key.decrypted +15 -0
- data/spec/fixtures/cert/server.key.encrypted +18 -0
- data/spec/fixtures/rsa.pem +15 -0
- data/spec/fixtures/rsa.pub +6 -0
- data/spec/fixtures/sign2-doc.xml +6 -0
- data/spec/fixtures/sign2-result.xml +24 -0
- data/spec/fixtures/sign3-result.xml +37 -0
- data/spec/lib/nokogiri/xml/document/encryption_and_decryption_spec.rb +22 -0
- data/spec/lib/nokogiri/xml/document/signing_and_verifying_spec.rb +77 -0
- data/spec/spec_helper.rb +10 -0
- metadata +251 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
From aa250927e6a919ba1a35189635e2e5084416f489 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Sun, 4 Aug 2013 22:25:03 +0200
|
4
|
+
Subject: [PATCH 08/14] Fix direct pattern matching
|
5
|
+
|
6
|
+
xsltTestCompMatchDirect must match against the original node.
|
7
|
+
---
|
8
|
+
libxslt/pattern.c | 5 +++--
|
9
|
+
tests/REC/test-5.2-22.out | 2 ++
|
10
|
+
tests/REC/test-5.2-22.xml | 3 +++
|
11
|
+
tests/REC/test-5.2-22.xsl | 13 +++++++++++++
|
12
|
+
4 files changed, 21 insertions(+), 2 deletions(-)
|
13
|
+
create mode 100644 tests/REC/test-5.2-22.out
|
14
|
+
create mode 100644 tests/REC/test-5.2-22.xml
|
15
|
+
create mode 100644 tests/REC/test-5.2-22.xsl
|
16
|
+
|
17
|
+
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
|
18
|
+
index 414363b..058917a 100644
|
19
|
+
--- a/libxslt/pattern.c
|
20
|
+
+++ b/libxslt/pattern.c
|
21
|
+
@@ -906,9 +906,10 @@ xsltTestPredicateMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
|
22
|
+
*/
|
23
|
+
static int
|
24
|
+
xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
|
25
|
+
- xmlNodePtr node, const xmlChar *mode,
|
26
|
+
+ xmlNodePtr matchNode, const xmlChar *mode,
|
27
|
+
const xmlChar *modeURI) {
|
28
|
+
int i;
|
29
|
+
+ xmlNodePtr node = matchNode;
|
30
|
+
xsltStepOpPtr step, sel = NULL;
|
31
|
+
xsltStepStates states = {0, 0, NULL}; /* // may require backtrack */
|
32
|
+
|
33
|
+
@@ -1137,7 +1138,7 @@ restart:
|
34
|
+
/* Free the rollback states */
|
35
|
+
xmlFree(states.states);
|
36
|
+
}
|
37
|
+
- return(xsltTestCompMatchDirect(ctxt, comp, node,
|
38
|
+
+ return(xsltTestCompMatchDirect(ctxt, comp, matchNode,
|
39
|
+
comp->nsList, comp->nsNr));
|
40
|
+
}
|
41
|
+
|
42
|
+
diff --git a/tests/REC/test-5.2-22.out b/tests/REC/test-5.2-22.out
|
43
|
+
new file mode 100644
|
44
|
+
index 0000000..951594e
|
45
|
+
--- /dev/null
|
46
|
+
+++ b/tests/REC/test-5.2-22.out
|
47
|
+
@@ -0,0 +1,2 @@
|
48
|
+
+<?xml version="1.0"?>
|
49
|
+
+<doc>success</doc>
|
50
|
+
diff --git a/tests/REC/test-5.2-22.xml b/tests/REC/test-5.2-22.xml
|
51
|
+
new file mode 100644
|
52
|
+
index 0000000..658099d
|
53
|
+
--- /dev/null
|
54
|
+
+++ b/tests/REC/test-5.2-22.xml
|
55
|
+
@@ -0,0 +1,3 @@
|
56
|
+
+<doc>
|
57
|
+
+ <elem/>
|
58
|
+
+</doc>
|
59
|
+
diff --git a/tests/REC/test-5.2-22.xsl b/tests/REC/test-5.2-22.xsl
|
60
|
+
new file mode 100644
|
61
|
+
index 0000000..5c1f1f7
|
62
|
+
--- /dev/null
|
63
|
+
+++ b/tests/REC/test-5.2-22.xsl
|
64
|
+
@@ -0,0 +1,13 @@
|
65
|
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
66
|
+
+
|
67
|
+
+ <xsl:template match="doc">
|
68
|
+
+ <xsl:copy>
|
69
|
+
+ <xsl:apply-templates select="*"/>
|
70
|
+
+ </xsl:copy>
|
71
|
+
+ </xsl:template>
|
72
|
+
+
|
73
|
+
+ <xsl:template match="doc[last()][last()]/elem">
|
74
|
+
+ <xsl:text>success</xsl:text>
|
75
|
+
+ </xsl:template>
|
76
|
+
+
|
77
|
+
+</xsl:stylesheet>
|
78
|
+
--
|
79
|
+
1.8.4.1
|
80
|
+
|
@@ -0,0 +1,185 @@
|
|
1
|
+
From cd40951e8e8a00e3ea022c2956d352bc131a54ba Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Sun, 4 Aug 2013 22:59:26 +0200
|
4
|
+
Subject: [PATCH 09/14] Fix certain patterns with predicates
|
5
|
+
|
6
|
+
The optimization for predicates in patterns only supports XSLT_OP_ELEM
|
7
|
+
and XSLT_OP_ALL. This commit makes predicates on other ops fall back to
|
8
|
+
the slow direct matching code path.
|
9
|
+
|
10
|
+
Fixes bugs #531685 and #538580.
|
11
|
+
---
|
12
|
+
libxslt/pattern.c | 18 ++++++++++++------
|
13
|
+
tests/docs/Makefile.am | 2 ++
|
14
|
+
tests/docs/bug-181.xml | 4 ++++
|
15
|
+
tests/docs/bug-182.xml | 4 ++++
|
16
|
+
tests/general/Makefile.am | 2 ++
|
17
|
+
tests/general/bug-181.out | 5 +++++
|
18
|
+
tests/general/bug-181.xsl | 13 +++++++++++++
|
19
|
+
tests/general/bug-182.out | 2 ++
|
20
|
+
tests/general/bug-182.xsl | 19 +++++++++++++++++++
|
21
|
+
9 files changed, 63 insertions(+), 6 deletions(-)
|
22
|
+
create mode 100644 tests/docs/bug-181.xml
|
23
|
+
create mode 100644 tests/docs/bug-182.xml
|
24
|
+
create mode 100644 tests/general/bug-181.out
|
25
|
+
create mode 100644 tests/general/bug-181.xsl
|
26
|
+
create mode 100644 tests/general/bug-182.out
|
27
|
+
create mode 100644 tests/general/bug-182.xsl
|
28
|
+
|
29
|
+
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
|
30
|
+
index 058917a..a97726c 100644
|
31
|
+
--- a/libxslt/pattern.c
|
32
|
+
+++ b/libxslt/pattern.c
|
33
|
+
@@ -451,11 +451,14 @@ xsltReverseCompMatch(xsltParserContextPtr ctxt, xsltCompMatchPtr comp) {
|
34
|
+
xsltCompMatchAdd(ctxt, comp, XSLT_OP_END, NULL, NULL, 0);
|
35
|
+
|
36
|
+
/*
|
37
|
+
- * detect consecutive XSLT_OP_PREDICATE indicating a direct
|
38
|
+
- * matching should be done.
|
39
|
+
+ * Detect consecutive XSLT_OP_PREDICATE and predicates on ops which
|
40
|
+
+ * haven't been optimized yet indicating a direct matching should be done.
|
41
|
+
*/
|
42
|
+
for (i = 0;i < comp->nbStep - 1;i++) {
|
43
|
+
- if ((comp->steps[i].op == XSLT_OP_PREDICATE) &&
|
44
|
+
+ xsltOp op = comp->steps[i].op;
|
45
|
+
+
|
46
|
+
+ if ((op != XSLT_OP_ELEM) &&
|
47
|
+
+ (op != XSLT_OP_ALL) &&
|
48
|
+
(comp->steps[i + 1].op == XSLT_OP_PREDICATE)) {
|
49
|
+
|
50
|
+
comp->direct = 1;
|
51
|
+
@@ -655,8 +658,10 @@ xsltTestPredicateMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
|
52
|
+
isRVT = 0;
|
53
|
+
|
54
|
+
/*
|
55
|
+
- * Depending on the last selection, one may need to
|
56
|
+
- * recompute contextSize and proximityPosition.
|
57
|
+
+ * Recompute contextSize and proximityPosition.
|
58
|
+
+ *
|
59
|
+
+ * TODO: Make this work for additional ops. Currently, only XSLT_OP_ELEM
|
60
|
+
+ * and XSLT_OP_ALL are supported.
|
61
|
+
*/
|
62
|
+
oldCS = ctxt->xpathCtxt->contextSize;
|
63
|
+
oldCP = ctxt->xpathCtxt->proximityPosition;
|
64
|
+
@@ -1128,7 +1133,8 @@ restart:
|
65
|
+
break;
|
66
|
+
case XSLT_OP_PREDICATE: {
|
67
|
+
/*
|
68
|
+
- * when there is cascading XSLT_OP_PREDICATE, then use a
|
69
|
+
+ * When there is cascading XSLT_OP_PREDICATE or a predicate
|
70
|
+
+ * after an op which hasn't been optimized yet, then use a
|
71
|
+
* direct computation approach. It's not done directly
|
72
|
+
* at the beginning of the routine to filter out as much
|
73
|
+
* as possible this costly computation.
|
74
|
+
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
|
75
|
+
index c5dad4c..e3a4aef 100644
|
76
|
+
--- a/tests/docs/Makefile.am
|
77
|
+
+++ b/tests/docs/Makefile.am
|
78
|
+
@@ -179,6 +179,8 @@ EXTRA_DIST = \
|
79
|
+
bug-178.xml \
|
80
|
+
bug-179.xml \
|
81
|
+
bug-180.xml \
|
82
|
+
+ bug-181.xml \
|
83
|
+
+ bug-182.xml \
|
84
|
+
character.xml \
|
85
|
+
array.xml \
|
86
|
+
items.xml
|
87
|
+
diff --git a/tests/docs/bug-181.xml b/tests/docs/bug-181.xml
|
88
|
+
new file mode 100644
|
89
|
+
index 0000000..285b69a
|
90
|
+
--- /dev/null
|
91
|
+
+++ b/tests/docs/bug-181.xml
|
92
|
+
@@ -0,0 +1,4 @@
|
93
|
+
+<Urmel>
|
94
|
+
+ <E>1. zwei <F>drei</F> zwei eins</E>
|
95
|
+
+ <E a="b">2. zwei <F>drei</F> zwei eins</E>
|
96
|
+
+</Urmel>
|
97
|
+
diff --git a/tests/docs/bug-182.xml b/tests/docs/bug-182.xml
|
98
|
+
new file mode 100644
|
99
|
+
index 0000000..02b378d
|
100
|
+
--- /dev/null
|
101
|
+
+++ b/tests/docs/bug-182.xml
|
102
|
+
@@ -0,0 +1,4 @@
|
103
|
+
+<?xml version="1.0" encoding="UTF-8" ?>
|
104
|
+
+<root>
|
105
|
+
+<body><b> b 1 </b> text 1 <b> b 2 </b> text 2 </body>
|
106
|
+
+</root>
|
107
|
+
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
|
108
|
+
index 0c2ef30..4802a6b 100644
|
109
|
+
--- a/tests/general/Makefile.am
|
110
|
+
+++ b/tests/general/Makefile.am
|
111
|
+
@@ -188,6 +188,8 @@ EXTRA_DIST = \
|
112
|
+
bug-178.out bug-178.xsl \
|
113
|
+
bug-179.out bug-179.xsl \
|
114
|
+
bug-180.out bug-180.xsl bug-180.err \
|
115
|
+
+ bug-181.out bug-181.xsl \
|
116
|
+
+ bug-182.out bug-182.xsl \
|
117
|
+
character.out character.xsl \
|
118
|
+
character2.out character2.xsl \
|
119
|
+
itemschoose.out itemschoose.xsl \
|
120
|
+
diff --git a/tests/general/bug-181.out b/tests/general/bug-181.out
|
121
|
+
new file mode 100644
|
122
|
+
index 0000000..730387a
|
123
|
+
--- /dev/null
|
124
|
+
+++ b/tests/general/bug-181.out
|
125
|
+
@@ -0,0 +1,5 @@
|
126
|
+
+<?xml version="1.0"?>
|
127
|
+
+<Urmel>
|
128
|
+
+ <E>1. * zwei <F>drei</F> zwei eins</E>
|
129
|
+
+ <E a="b">2. * zwei <F>drei</F> zwei eins</E>
|
130
|
+
+</Urmel>
|
131
|
+
diff --git a/tests/general/bug-181.xsl b/tests/general/bug-181.xsl
|
132
|
+
new file mode 100644
|
133
|
+
index 0000000..0c4de71
|
134
|
+
--- /dev/null
|
135
|
+
+++ b/tests/general/bug-181.xsl
|
136
|
+
@@ -0,0 +1,13 @@
|
137
|
+
+<xsl:transform version="1.0"
|
138
|
+
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
139
|
+
+ <xsl:template match="E/text()[ 1 ]">
|
140
|
+
+ <xsl:value-of select="substring-before( . , ' ')"/>
|
141
|
+
+ <xsl:text> * </xsl:text>
|
142
|
+
+ <xsl:value-of select="substring-after( . , ' ')"/>
|
143
|
+
+ </xsl:template>
|
144
|
+
+ <xsl:template match="@*|node()">
|
145
|
+
+ <xsl:copy>
|
146
|
+
+ <xsl:apply-templates select="@*|node()"/>
|
147
|
+
+ </xsl:copy>
|
148
|
+
+ </xsl:template>
|
149
|
+
+</xsl:transform>
|
150
|
+
diff --git a/tests/general/bug-182.out b/tests/general/bug-182.out
|
151
|
+
new file mode 100644
|
152
|
+
index 0000000..93ab15e
|
153
|
+
--- /dev/null
|
154
|
+
+++ b/tests/general/bug-182.out
|
155
|
+
@@ -0,0 +1,2 @@
|
156
|
+
+<?xml version="1.0"?>
|
157
|
+
+<body><p>b[2]: b 2 </p><p>text()[2]: text 2 </p></body>
|
158
|
+
diff --git a/tests/general/bug-182.xsl b/tests/general/bug-182.xsl
|
159
|
+
new file mode 100644
|
160
|
+
index 0000000..ecce187
|
161
|
+
--- /dev/null
|
162
|
+
+++ b/tests/general/bug-182.xsl
|
163
|
+
@@ -0,0 +1,19 @@
|
164
|
+
+<?xml version="1.0" encoding="UTF-8" ?>
|
165
|
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
166
|
+
+
|
167
|
+
+<xsl:template match="node()"/>
|
168
|
+
+
|
169
|
+
+<xsl:template match="text()[2]">
|
170
|
+
+ <p>text()[2]: <xsl:value-of select="."/></p>
|
171
|
+
+</xsl:template>
|
172
|
+
+<xsl:template match="b[2]">
|
173
|
+
+ <p>b[2]: <xsl:value-of select="."/></p>
|
174
|
+
+</xsl:template>
|
175
|
+
+
|
176
|
+
+<xsl:template match="/">
|
177
|
+
+ <body>
|
178
|
+
+ <xsl:apply-templates select="/root/body/node()"/>
|
179
|
+
+ </body>
|
180
|
+
+</xsl:template>
|
181
|
+
+
|
182
|
+
+</xsl:stylesheet>
|
183
|
+
--
|
184
|
+
1.8.4.1
|
185
|
+
|
@@ -0,0 +1,126 @@
|
|
1
|
+
From 387c26fa4a21eaea74facde3f8628c25361f6f83 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Thu, 1 Aug 2013 17:56:36 +0200
|
4
|
+
Subject: [PATCH 10/14] Fix handling of UTF-8 strings in EXSLT crypto module
|
5
|
+
|
6
|
+
Fixes bug #692866
|
7
|
+
---
|
8
|
+
libexslt/crypto.c | 27 +++++++++++++--------------
|
9
|
+
1 file changed, 13 insertions(+), 14 deletions(-)
|
10
|
+
|
11
|
+
diff --git a/libexslt/crypto.c b/libexslt/crypto.c
|
12
|
+
index d142bb6..6aa9dd2 100644
|
13
|
+
--- a/libexslt/crypto.c
|
14
|
+
+++ b/libexslt/crypto.c
|
15
|
+
@@ -457,7 +457,8 @@ exsltCryptoGcryptRc4Decrypt (xmlXPathParserContextPtr ctxt,
|
16
|
+
* @ctxt: an XPath parser context
|
17
|
+
* @nargs: the number of arguments
|
18
|
+
*
|
19
|
+
- * Helper function which checks for and returns first string argument and its length
|
20
|
+
+ * Helper function which checks for and returns first string argument and its
|
21
|
+
+ * length in bytes.
|
22
|
+
*/
|
23
|
+
static int
|
24
|
+
exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs,
|
25
|
+
@@ -471,7 +472,7 @@ exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs,
|
26
|
+
}
|
27
|
+
|
28
|
+
*str = xmlXPathPopString (ctxt);
|
29
|
+
- str_len = xmlUTF8Strlen (*str);
|
30
|
+
+ str_len = xmlStrlen (*str);
|
31
|
+
|
32
|
+
if (str_len == 0) {
|
33
|
+
xmlXPathReturnEmptyString (ctxt);
|
34
|
+
@@ -591,7 +592,7 @@ exsltCryptoSha1Function (xmlXPathParserContextPtr ctxt, int nargs) {
|
35
|
+
static void
|
36
|
+
exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
37
|
+
|
38
|
+
- int key_len = 0, key_size = 0;
|
39
|
+
+ int key_len = 0;
|
40
|
+
int str_len = 0, bin_len = 0, hex_len = 0;
|
41
|
+
xmlChar *key = NULL, *str = NULL, *padkey = NULL;
|
42
|
+
xmlChar *bin = NULL, *hex = NULL;
|
43
|
+
@@ -604,7 +605,7 @@ exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
44
|
+
tctxt = xsltXPathGetTransformContext(ctxt);
|
45
|
+
|
46
|
+
str = xmlXPathPopString (ctxt);
|
47
|
+
- str_len = xmlUTF8Strlen (str);
|
48
|
+
+ str_len = xmlStrlen (str);
|
49
|
+
|
50
|
+
if (str_len == 0) {
|
51
|
+
xmlXPathReturnEmptyString (ctxt);
|
52
|
+
@@ -613,7 +614,7 @@ exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
53
|
+
}
|
54
|
+
|
55
|
+
key = xmlXPathPopString (ctxt);
|
56
|
+
- key_len = xmlUTF8Strlen (key);
|
57
|
+
+ key_len = xmlStrlen (key);
|
58
|
+
|
59
|
+
if (key_len == 0) {
|
60
|
+
xmlXPathReturnEmptyString (ctxt);
|
61
|
+
@@ -632,15 +633,14 @@ exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
62
|
+
}
|
63
|
+
memset(padkey, 0, RC4_KEY_LENGTH + 1);
|
64
|
+
|
65
|
+
- key_size = xmlUTF8Strsize (key, key_len);
|
66
|
+
- if ((key_size > RC4_KEY_LENGTH) || (key_size < 0)) {
|
67
|
+
+ if ((key_len > RC4_KEY_LENGTH) || (key_len < 0)) {
|
68
|
+
xsltTransformError(tctxt, NULL, tctxt->inst,
|
69
|
+
"exsltCryptoRc4EncryptFunction: key size too long or key broken\n");
|
70
|
+
tctxt->state = XSLT_STATE_STOPPED;
|
71
|
+
xmlXPathReturnEmptyString (ctxt);
|
72
|
+
goto done;
|
73
|
+
}
|
74
|
+
- memcpy (padkey, key, key_size);
|
75
|
+
+ memcpy (padkey, key, key_len);
|
76
|
+
|
77
|
+
/* encrypt it */
|
78
|
+
bin_len = str_len;
|
79
|
+
@@ -689,7 +689,7 @@ done:
|
80
|
+
static void
|
81
|
+
exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
82
|
+
|
83
|
+
- int key_len = 0, key_size = 0;
|
84
|
+
+ int key_len = 0;
|
85
|
+
int str_len = 0, bin_len = 0, ret_len = 0;
|
86
|
+
xmlChar *key = NULL, *str = NULL, *padkey = NULL, *bin =
|
87
|
+
NULL, *ret = NULL;
|
88
|
+
@@ -702,7 +702,7 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
89
|
+
tctxt = xsltXPathGetTransformContext(ctxt);
|
90
|
+
|
91
|
+
str = xmlXPathPopString (ctxt);
|
92
|
+
- str_len = xmlUTF8Strlen (str);
|
93
|
+
+ str_len = xmlStrlen (str);
|
94
|
+
|
95
|
+
if (str_len == 0) {
|
96
|
+
xmlXPathReturnEmptyString (ctxt);
|
97
|
+
@@ -711,7 +711,7 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
98
|
+
}
|
99
|
+
|
100
|
+
key = xmlXPathPopString (ctxt);
|
101
|
+
- key_len = xmlUTF8Strlen (key);
|
102
|
+
+ key_len = xmlStrlen (key);
|
103
|
+
|
104
|
+
if (key_len == 0) {
|
105
|
+
xmlXPathReturnEmptyString (ctxt);
|
106
|
+
@@ -729,15 +729,14 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
107
|
+
goto done;
|
108
|
+
}
|
109
|
+
memset(padkey, 0, RC4_KEY_LENGTH + 1);
|
110
|
+
- key_size = xmlUTF8Strsize (key, key_len);
|
111
|
+
- if ((key_size > RC4_KEY_LENGTH) || (key_size < 0)) {
|
112
|
+
+ if ((key_len > RC4_KEY_LENGTH) || (key_len < 0)) {
|
113
|
+
xsltTransformError(tctxt, NULL, tctxt->inst,
|
114
|
+
"exsltCryptoRc4EncryptFunction: key size too long or key broken\n");
|
115
|
+
tctxt->state = XSLT_STATE_STOPPED;
|
116
|
+
xmlXPathReturnEmptyString (ctxt);
|
117
|
+
goto done;
|
118
|
+
}
|
119
|
+
- memcpy (padkey, key, key_size);
|
120
|
+
+ memcpy (padkey, key, key_len);
|
121
|
+
|
122
|
+
/* decode hex to binary */
|
123
|
+
bin_len = str_len;
|
124
|
+
--
|
125
|
+
1.8.4.1
|
126
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
From a976434b620a5d81a1cea8867ebc49d748c93a88 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
3
|
+
Date: Mon, 5 Aug 2013 12:37:06 +0200
|
4
|
+
Subject: [PATCH 13/14] Memory leak in xsltCompileIdKeyPattern error path
|
5
|
+
|
6
|
+
Fix from bug #691548 by Vladimir Marek.
|
7
|
+
---
|
8
|
+
libxslt/pattern.c | 1 +
|
9
|
+
1 file changed, 1 insertion(+)
|
10
|
+
|
11
|
+
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
|
12
|
+
index a97726c..57f8b9f 100644
|
13
|
+
--- a/libxslt/pattern.c
|
14
|
+
+++ b/libxslt/pattern.c
|
15
|
+
@@ -1433,6 +1433,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
|
16
|
+
if (CUR != ',') {
|
17
|
+
xsltTransformError(NULL, NULL, NULL,
|
18
|
+
"xsltCompileIdKeyPattern : , expected\n");
|
19
|
+
+ xmlFree(lit);
|
20
|
+
ctxt->error = 1;
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
--
|
24
|
+
1.8.4.1
|
25
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
From 02b30799fe2f8a572f6eefb27b2b9f1265fc0db7 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Imran Azeezullah <uqsazeez@uq.edu.au>
|
3
|
+
Date: Mon, 30 Sep 2013 10:18:03 +0800
|
4
|
+
Subject: [PATCH 14/14] Fix for bug 436589
|
5
|
+
|
6
|
+
https://bugzilla.gnome.org/show_bug.cgi?id=436589
|
7
|
+
|
8
|
+
Need to check availablility of argument before scanning it
|
9
|
+
---
|
10
|
+
xsltproc/xsltproc.c | 10 ++++++++++
|
11
|
+
1 file changed, 10 insertions(+)
|
12
|
+
|
13
|
+
diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c
|
14
|
+
index 45adf5d..b22df37 100644
|
15
|
+
--- a/xsltproc/xsltproc.c
|
16
|
+
+++ b/xsltproc/xsltproc.c
|
17
|
+
@@ -730,6 +730,11 @@ main(int argc, char **argv)
|
18
|
+
int value;
|
19
|
+
|
20
|
+
i++;
|
21
|
+
+ if (i == argc) {
|
22
|
+
+ fprintf(stderr, "XSLT maxdepth value not specified!\n");
|
23
|
+
+ return (2);
|
24
|
+
+ }
|
25
|
+
+
|
26
|
+
if (sscanf(argv[i], "%d", &value) == 1) {
|
27
|
+
if (value > 0)
|
28
|
+
xsltMaxDepth = value;
|
29
|
+
@@ -748,6 +753,11 @@ main(int argc, char **argv)
|
30
|
+
int value;
|
31
|
+
|
32
|
+
i++;
|
33
|
+
+ if (i == argc) {
|
34
|
+
+ fprintf(stderr, "XML maxparserdepth value not specified!\n");
|
35
|
+
+ return (2);
|
36
|
+
+ }
|
37
|
+
+
|
38
|
+
if (sscanf(argv[i], "%d", &value) == 1) {
|
39
|
+
if (value > 0)
|
40
|
+
xmlParserMaxDepth = value;
|
41
|
+
--
|
42
|
+
1.8.4.1
|
43
|
+
|