nokogiri-xmlsec1 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dependencies.yml +1 -1
- data/lib/xmlsec/version.rb +1 -1
- data/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch +29 -0
- data/ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch +31 -0
- metadata +3 -12
- data/ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch +0 -265
- data/ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch +0 -102
- data/ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch +0 -26
- data/ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch +0 -26
- data/ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch +0 -158
- data/ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch +0 -78
- data/ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch +0 -480
- data/ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch +0 -315
- data/ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch +0 -37
- data/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch +0 -2006
- data/ports/patches/libxml2/0011-Do-not-fetch-external-parameter-entities.patch +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbe7884984dbb37a83b95a004e02963912977abe
|
4
|
+
data.tar.gz: ed73522eadca8444485de6b65187534382d5cab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a5bc53ced634554cd98476cc26cd51629aeca44624ceec5db0fa37aefe9bdd3231f6e3637f8a91bc9178a7e78dfd33b75cf59666e39a91f8f9448baee7e305f
|
7
|
+
data.tar.gz: 2d9a17aee39594c252ef21675b432d469d081cd64abdf2bdde4707aa7b440fca937f789d9ae0124b571d0c73beb1530b96b9a58a79dbf16cf4c53467f057e7ba
|
data/dependencies.yml
CHANGED
data/lib/xmlsec/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
From f65128f38289d77ff322d63aef2858cc0a819c34 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Daniel Veillard <veillard@redhat.com>
|
3
|
+
Date: Fri, 17 Oct 2014 17:13:41 +0800
|
4
|
+
Subject: [PATCH] Revert "Missing initialization for the catalog module"
|
5
|
+
|
6
|
+
This reverts commit 054c716ea1bf001544127a4ab4f4346d1b9947e7.
|
7
|
+
As this break xmlcatalog command
|
8
|
+
https://bugzilla.redhat.com/show_bug.cgi?id=1153753
|
9
|
+
---
|
10
|
+
parser.c | 3 ---
|
11
|
+
1 file changed, 3 deletions(-)
|
12
|
+
|
13
|
+
diff --git a/parser.c b/parser.c
|
14
|
+
index 1d93967..67c9dfd 100644
|
15
|
+
--- a/parser.c
|
16
|
+
+++ b/parser.c
|
17
|
+
@@ -14830,9 +14830,6 @@ xmlInitParser(void) {
|
18
|
+
#ifdef LIBXML_XPATH_ENABLED
|
19
|
+
xmlXPathInit();
|
20
|
+
#endif
|
21
|
+
-#ifdef LIBXML_CATALOG_ENABLED
|
22
|
+
- xmlInitializeCatalog();
|
23
|
+
-#endif
|
24
|
+
xmlParserInitialized = 1;
|
25
|
+
#ifdef LIBXML_THREAD_ENABLED
|
26
|
+
}
|
27
|
+
--
|
28
|
+
2.1.2
|
29
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Daniel Veillard <veillard@redhat.com>
|
3
|
+
Date: Thu, 23 Oct 2014 11:35:36 +0800
|
4
|
+
Subject: [PATCH] Fix missing entities after CVE-2014-3660 fix
|
5
|
+
|
6
|
+
For https://bugzilla.gnome.org/show_bug.cgi?id=738805
|
7
|
+
|
8
|
+
The fix for CVE-2014-3660 introduced a regression in some case
|
9
|
+
where entity substitution is required and the entity is used
|
10
|
+
first in anotther entity referenced from an attribute value
|
11
|
+
---
|
12
|
+
parser.c | 3 ++-
|
13
|
+
1 file changed, 2 insertions(+), 1 deletion(-)
|
14
|
+
|
15
|
+
diff --git a/parser.c b/parser.c
|
16
|
+
index 67c9dfd..a8d1b67 100644
|
17
|
+
--- a/parser.c
|
18
|
+
+++ b/parser.c
|
19
|
+
@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
20
|
+
* far more secure as the parser will only process data coming from
|
21
|
+
* the document entity by default.
|
22
|
+
*/
|
23
|
+
- if ((ent->checked == 0) &&
|
24
|
+
+ if (((ent->checked == 0) ||
|
25
|
+
+ ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
|
26
|
+
((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
|
27
|
+
(ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
|
28
|
+
unsigned long oldnbent = ctxt->nbentities;
|
29
|
+
--
|
30
|
+
2.1.2
|
31
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri-xmlsec1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renan Mendes Carvalho
|
@@ -175,17 +175,8 @@ files:
|
|
175
175
|
- lib/xmlsec.rb
|
176
176
|
- lib/xmlsec/version.rb
|
177
177
|
- nokogiri-xmlsec1.gemspec
|
178
|
-
- ports/patches/libxml2/0001-
|
179
|
-
- ports/patches/libxml2/0002-Fix-entities-
|
180
|
-
- ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch
|
181
|
-
- ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch
|
182
|
-
- ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch
|
183
|
-
- ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch
|
184
|
-
- ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
|
185
|
-
- ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch
|
186
|
-
- ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch
|
187
|
-
- ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
|
188
|
-
- ports/patches/libxml2/0011-Do-not-fetch-external-parameter-entities.patch
|
178
|
+
- ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch
|
179
|
+
- ports/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
|
189
180
|
- ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch
|
190
181
|
- ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
|
191
182
|
- ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch
|
@@ -1,265 +0,0 @@
|
|
1
|
-
From bc168aab5749acbe6630a29be4dcfabf0a81e2da Mon Sep 17 00:00:00 2001
|
2
|
-
From: Daniel Veillard <veillard@redhat.com>
|
3
|
-
Date: Tue, 17 Jul 2012 16:19:17 +0800
|
4
|
-
Subject: [PATCH 1/9] Fix parser local buffers size problems
|
5
|
-
|
6
|
-
[Origin: 459eeb9dc752d5185f57ff6b135027f11981a626]
|
7
|
-
---
|
8
|
-
parser.c | 74 +++++++++++++++++++++++++++++++++++++---------------------------
|
9
|
-
1 file changed, 43 insertions(+), 31 deletions(-)
|
10
|
-
|
11
|
-
diff --git a/parser.c b/parser.c
|
12
|
-
index 2c38fae..9863275 100644
|
13
|
-
--- a/parser.c
|
14
|
-
+++ b/parser.c
|
15
|
-
@@ -40,6 +40,7 @@
|
16
|
-
#endif
|
17
|
-
|
18
|
-
#include <stdlib.h>
|
19
|
-
+#include <limits.h>
|
20
|
-
#include <string.h>
|
21
|
-
#include <stdarg.h>
|
22
|
-
#include <libxml/xmlmemory.h>
|
23
|
-
@@ -117,10 +118,10 @@ xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
|
24
|
-
* parser option.
|
25
|
-
*/
|
26
|
-
static int
|
27
|
-
-xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long size,
|
28
|
-
+xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
|
29
|
-
xmlEntityPtr ent)
|
30
|
-
{
|
31
|
-
- unsigned long consumed = 0;
|
32
|
-
+ size_t consumed = 0;
|
33
|
-
|
34
|
-
if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE))
|
35
|
-
return (0);
|
36
|
-
@@ -2589,15 +2590,17 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
|
37
|
-
|
38
|
-
/*
|
39
|
-
* Macro used to grow the current buffer.
|
40
|
-
+ * buffer##_size is expected to be a size_t
|
41
|
-
+ * mem_error: is expected to handle memory allocation failures
|
42
|
-
*/
|
43
|
-
#define growBuffer(buffer, n) { \
|
44
|
-
xmlChar *tmp; \
|
45
|
-
- buffer##_size *= 2; \
|
46
|
-
- buffer##_size += n; \
|
47
|
-
- tmp = (xmlChar *) \
|
48
|
-
- xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \
|
49
|
-
+ size_t new_size = buffer##_size * 2 + n; \
|
50
|
-
+ if (new_size < buffer##_size) goto mem_error; \
|
51
|
-
+ tmp = (xmlChar *) xmlRealloc(buffer, new_size); \
|
52
|
-
if (tmp == NULL) goto mem_error; \
|
53
|
-
buffer = tmp; \
|
54
|
-
+ buffer##_size = new_size; \
|
55
|
-
}
|
56
|
-
|
57
|
-
/**
|
58
|
-
@@ -2623,14 +2626,14 @@ xmlChar *
|
59
|
-
xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
60
|
-
int what, xmlChar end, xmlChar end2, xmlChar end3) {
|
61
|
-
xmlChar *buffer = NULL;
|
62
|
-
- int buffer_size = 0;
|
63
|
-
+ size_t buffer_size = 0;
|
64
|
-
+ size_t nbchars = 0;
|
65
|
-
|
66
|
-
xmlChar *current = NULL;
|
67
|
-
xmlChar *rep = NULL;
|
68
|
-
const xmlChar *last;
|
69
|
-
xmlEntityPtr ent;
|
70
|
-
int c,l;
|
71
|
-
- int nbchars = 0;
|
72
|
-
|
73
|
-
if ((ctxt == NULL) || (str == NULL) || (len < 0))
|
74
|
-
return(NULL);
|
75
|
-
@@ -2647,7 +2650,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
76
|
-
* allocate a translation buffer.
|
77
|
-
*/
|
78
|
-
buffer_size = XML_PARSER_BIG_BUFFER_SIZE;
|
79
|
-
- buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar));
|
80
|
-
+ buffer = (xmlChar *) xmlMallocAtomic(buffer_size);
|
81
|
-
if (buffer == NULL) goto mem_error;
|
82
|
-
|
83
|
-
/*
|
84
|
-
@@ -2667,7 +2670,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
85
|
-
if (val != 0) {
|
86
|
-
COPY_BUF(0,buffer,nbchars,val);
|
87
|
-
}
|
88
|
-
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
|
89
|
-
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
90
|
-
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
91
|
-
}
|
92
|
-
} else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) {
|
93
|
-
@@ -2685,7 +2688,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
94
|
-
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
95
|
-
if (ent->content != NULL) {
|
96
|
-
COPY_BUF(0,buffer,nbchars,ent->content[0]);
|
97
|
-
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
|
98
|
-
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
99
|
-
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
100
|
-
}
|
101
|
-
} else {
|
102
|
-
@@ -2702,8 +2705,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
103
|
-
current = rep;
|
104
|
-
while (*current != 0) { /* non input consuming loop */
|
105
|
-
buffer[nbchars++] = *current++;
|
106
|
-
- if (nbchars >
|
107
|
-
- buffer_size - XML_PARSER_BUFFER_SIZE) {
|
108
|
-
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
109
|
-
if (xmlParserEntityCheck(ctxt, nbchars, ent))
|
110
|
-
goto int_error;
|
111
|
-
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
112
|
-
@@ -2717,7 +2719,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
113
|
-
const xmlChar *cur = ent->name;
|
114
|
-
|
115
|
-
buffer[nbchars++] = '&';
|
116
|
-
- if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) {
|
117
|
-
+ if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
118
|
-
growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE);
|
119
|
-
}
|
120
|
-
for (;i > 0;i--)
|
121
|
-
@@ -2745,8 +2747,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
122
|
-
current = rep;
|
123
|
-
while (*current != 0) { /* non input consuming loop */
|
124
|
-
buffer[nbchars++] = *current++;
|
125
|
-
- if (nbchars >
|
126
|
-
- buffer_size - XML_PARSER_BUFFER_SIZE) {
|
127
|
-
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
128
|
-
if (xmlParserEntityCheck(ctxt, nbchars, ent))
|
129
|
-
goto int_error;
|
130
|
-
growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
131
|
-
@@ -2759,8 +2760,8 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
132
|
-
} else {
|
133
|
-
COPY_BUF(l,buffer,nbchars,c);
|
134
|
-
str += l;
|
135
|
-
- if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) {
|
136
|
-
- growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
137
|
-
+ if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) {
|
138
|
-
+ growBuffer(buffer, XML_PARSER_BUFFER_SIZE);
|
139
|
-
}
|
140
|
-
}
|
141
|
-
if (str < last)
|
142
|
-
@@ -3764,8 +3765,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
143
|
-
xmlChar limit = 0;
|
144
|
-
xmlChar *buf = NULL;
|
145
|
-
xmlChar *rep = NULL;
|
146
|
-
- int len = 0;
|
147
|
-
- int buf_size = 0;
|
148
|
-
+ size_t len = 0;
|
149
|
-
+ size_t buf_size = 0;
|
150
|
-
int c, l, in_space = 0;
|
151
|
-
xmlChar *current = NULL;
|
152
|
-
xmlEntityPtr ent;
|
153
|
-
@@ -3787,7 +3788,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
154
|
-
* allocate a translation buffer.
|
155
|
-
*/
|
156
|
-
buf_size = XML_PARSER_BUFFER_SIZE;
|
157
|
-
- buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar));
|
158
|
-
+ buf = (xmlChar *) xmlMallocAtomic(buf_size);
|
159
|
-
if (buf == NULL) goto mem_error;
|
160
|
-
|
161
|
-
/*
|
162
|
-
@@ -3804,7 +3805,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
163
|
-
|
164
|
-
if (val == '&') {
|
165
|
-
if (ctxt->replaceEntities) {
|
166
|
-
- if (len > buf_size - 10) {
|
167
|
-
+ if (len + 10 > buf_size) {
|
168
|
-
growBuffer(buf, 10);
|
169
|
-
}
|
170
|
-
buf[len++] = '&';
|
171
|
-
@@ -3813,7 +3814,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
172
|
-
* The reparsing will be done in xmlStringGetNodeList()
|
173
|
-
* called by the attribute() function in SAX.c
|
174
|
-
*/
|
175
|
-
- if (len > buf_size - 10) {
|
176
|
-
+ if (len + 10 > buf_size) {
|
177
|
-
growBuffer(buf, 10);
|
178
|
-
}
|
179
|
-
buf[len++] = '&';
|
180
|
-
@@ -3823,7 +3824,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
181
|
-
buf[len++] = ';';
|
182
|
-
}
|
183
|
-
} else if (val != 0) {
|
184
|
-
- if (len > buf_size - 10) {
|
185
|
-
+ if (len + 10 > buf_size) {
|
186
|
-
growBuffer(buf, 10);
|
187
|
-
}
|
188
|
-
len += xmlCopyChar(0, &buf[len], val);
|
189
|
-
@@ -3835,7 +3836,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
190
|
-
ctxt->nbentities += ent->owner;
|
191
|
-
if ((ent != NULL) &&
|
192
|
-
(ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) {
|
193
|
-
- if (len > buf_size - 10) {
|
194
|
-
+ if (len + 10 > buf_size) {
|
195
|
-
growBuffer(buf, 10);
|
196
|
-
}
|
197
|
-
if ((ctxt->replaceEntities == 0) &&
|
198
|
-
@@ -3863,7 +3864,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
199
|
-
current++;
|
200
|
-
} else
|
201
|
-
buf[len++] = *current++;
|
202
|
-
- if (len > buf_size - 10) {
|
203
|
-
+ if (len + 10 > buf_size) {
|
204
|
-
growBuffer(buf, 10);
|
205
|
-
}
|
206
|
-
}
|
207
|
-
@@ -3871,7 +3872,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
208
|
-
rep = NULL;
|
209
|
-
}
|
210
|
-
} else {
|
211
|
-
- if (len > buf_size - 10) {
|
212
|
-
+ if (len + 10 > buf_size) {
|
213
|
-
growBuffer(buf, 10);
|
214
|
-
}
|
215
|
-
if (ent->content != NULL)
|
216
|
-
@@ -3899,7 +3900,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
217
|
-
* Just output the reference
|
218
|
-
*/
|
219
|
-
buf[len++] = '&';
|
220
|
-
- while (len > buf_size - i - 10) {
|
221
|
-
+ while (len + i + 10 > buf_size) {
|
222
|
-
growBuffer(buf, i + 10);
|
223
|
-
}
|
224
|
-
for (;i > 0;i--)
|
225
|
-
@@ -3912,7 +3913,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
226
|
-
if ((len != 0) || (!normalize)) {
|
227
|
-
if ((!normalize) || (!in_space)) {
|
228
|
-
COPY_BUF(l,buf,len,0x20);
|
229
|
-
- while (len > buf_size - 10) {
|
230
|
-
+ while (len + 10 > buf_size) {
|
231
|
-
growBuffer(buf, 10);
|
232
|
-
}
|
233
|
-
}
|
234
|
-
@@ -3921,7 +3922,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
235
|
-
} else {
|
236
|
-
in_space = 0;
|
237
|
-
COPY_BUF(l,buf,len,c);
|
238
|
-
- if (len > buf_size - 10) {
|
239
|
-
+ if (len + 10 > buf_size) {
|
240
|
-
growBuffer(buf, 10);
|
241
|
-
}
|
242
|
-
}
|
243
|
-
@@ -3946,7 +3947,18 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
244
|
-
}
|
245
|
-
} else
|
246
|
-
NEXT;
|
247
|
-
- if (attlen != NULL) *attlen = len;
|
248
|
-
+
|
249
|
-
+ /*
|
250
|
-
+ * There we potentially risk an overflow, don't allow attribute value of
|
251
|
-
+ * lenght more than INT_MAX it is a very reasonnable assumption !
|
252
|
-
+ */
|
253
|
-
+ if (len >= INT_MAX) {
|
254
|
-
+ xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED,
|
255
|
-
+ "AttValue lenght too long\n");
|
256
|
-
+ goto mem_error;
|
257
|
-
+ }
|
258
|
-
+
|
259
|
-
+ if (attlen != NULL) *attlen = (int) len;
|
260
|
-
return(buf);
|
261
|
-
|
262
|
-
mem_error:
|
263
|
-
--
|
264
|
-
1.8.4.1
|
265
|
-
|
@@ -1,102 +0,0 @@
|
|
1
|
-
From 64d7de23165b706510f4ce4f29d96552eeb257d7 Mon Sep 17 00:00:00 2001
|
2
|
-
From: Daniel Veillard <veillard@redhat.com>
|
3
|
-
Date: Wed, 18 Jul 2012 11:38:17 +0800
|
4
|
-
Subject: [PATCH 2/9] Fix entities local buffers size problems
|
5
|
-
|
6
|
-
[Origin: 4f9fdc709c4861c390cd84e2ed1fd878b3442e28]
|
7
|
-
---
|
8
|
-
entities.c | 36 +++++++++++++++++++++++-------------
|
9
|
-
1 file changed, 23 insertions(+), 13 deletions(-)
|
10
|
-
|
11
|
-
diff --git a/entities.c b/entities.c
|
12
|
-
index 6aef49f..859ec3b 100644
|
13
|
-
--- a/entities.c
|
14
|
-
+++ b/entities.c
|
15
|
-
@@ -528,13 +528,13 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
|
16
|
-
* Macro used to grow the current buffer.
|
17
|
-
*/
|
18
|
-
#define growBufferReentrant() { \
|
19
|
-
- buffer_size *= 2; \
|
20
|
-
- buffer = (xmlChar *) \
|
21
|
-
- xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \
|
22
|
-
- if (buffer == NULL) { \
|
23
|
-
- xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");\
|
24
|
-
- return(NULL); \
|
25
|
-
- } \
|
26
|
-
+ xmlChar *tmp; \
|
27
|
-
+ size_t new_size = buffer_size *= 2; \
|
28
|
-
+ if (new_size < buffer_size) goto mem_error; \
|
29
|
-
+ tmp = (xmlChar *) xmlRealloc(buffer, new_size); \
|
30
|
-
+ if (tmp == NULL) goto mem_error; \
|
31
|
-
+ buffer = tmp; \
|
32
|
-
+ buffer_size = new_size; \
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
@@ -555,7 +555,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
|
37
|
-
const xmlChar *cur = input;
|
38
|
-
xmlChar *buffer = NULL;
|
39
|
-
xmlChar *out = NULL;
|
40
|
-
- int buffer_size = 0;
|
41
|
-
+ size_t buffer_size = 0;
|
42
|
-
int html = 0;
|
43
|
-
|
44
|
-
if (input == NULL) return(NULL);
|
45
|
-
@@ -574,8 +574,8 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
|
46
|
-
out = buffer;
|
47
|
-
|
48
|
-
while (*cur != '\0') {
|
49
|
-
- if (out - buffer > buffer_size - 100) {
|
50
|
-
- int indx = out - buffer;
|
51
|
-
+ size_t indx = out - buffer;
|
52
|
-
+ if (indx + 100 > buffer_size) {
|
53
|
-
|
54
|
-
growBufferReentrant();
|
55
|
-
out = &buffer[indx];
|
56
|
-
@@ -692,6 +692,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
|
57
|
-
}
|
58
|
-
*out = 0;
|
59
|
-
return(buffer);
|
60
|
-
+
|
61
|
-
+mem_error:
|
62
|
-
+ xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");
|
63
|
-
+ xmlFree(buffer);
|
64
|
-
+ return(NULL);
|
65
|
-
}
|
66
|
-
|
67
|
-
/**
|
68
|
-
@@ -709,7 +714,7 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
|
69
|
-
const xmlChar *cur = input;
|
70
|
-
xmlChar *buffer = NULL;
|
71
|
-
xmlChar *out = NULL;
|
72
|
-
- int buffer_size = 0;
|
73
|
-
+ size_t buffer_size = 0;
|
74
|
-
if (input == NULL) return(NULL);
|
75
|
-
|
76
|
-
/*
|
77
|
-
@@ -724,8 +729,8 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
|
78
|
-
out = buffer;
|
79
|
-
|
80
|
-
while (*cur != '\0') {
|
81
|
-
- if (out - buffer > buffer_size - 10) {
|
82
|
-
- int indx = out - buffer;
|
83
|
-
+ size_t indx = out - buffer;
|
84
|
-
+ if (indx + 10 > buffer_size) {
|
85
|
-
|
86
|
-
growBufferReentrant();
|
87
|
-
out = &buffer[indx];
|
88
|
-
@@ -774,6 +779,11 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
|
89
|
-
}
|
90
|
-
*out = 0;
|
91
|
-
return(buffer);
|
92
|
-
+
|
93
|
-
+mem_error:
|
94
|
-
+ xmlEntitiesErrMemory("xmlEncodeSpecialChars: realloc failed");
|
95
|
-
+ xmlFree(buffer);
|
96
|
-
+ return(NULL);
|
97
|
-
}
|
98
|
-
|
99
|
-
/**
|
100
|
-
--
|
101
|
-
1.8.4.1
|
102
|
-
|