nokogiri 1.6.7.2 → 1.6.8.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +12 -9
- data/CHANGELOG.ja.rdoc +18 -0
- data/CHANGELOG.rdoc +12 -7
- data/CONTRIBUTING.md +42 -0
- data/Gemfile +1 -1
- data/Manifest.txt +6 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/nokogiri +2 -2
- data/dependencies.yml +1 -1
- data/ext/nokogiri/extconf.rb +3 -3
- data/ext/nokogiri/nokogiri.c +0 -7
- data/ext/nokogiri/nokogiri.h +1 -34
- data/ext/nokogiri/xml_document.c +2 -4
- data/ext/nokogiri/xml_namespace.c +56 -17
- data/ext/nokogiri/xml_node.c +12 -36
- data/ext/nokogiri/xml_node_set.c +169 -143
- data/ext/nokogiri/xml_node_set.h +3 -4
- data/ext/nokogiri/xml_sax_parser.c +2 -5
- data/ext/nokogiri/xml_syntax_error.c +0 -4
- data/ext/nokogiri/xml_syntax_error.h +0 -1
- data/ext/nokogiri/xml_xpath_context.c +9 -18
- data/lib/nokogiri.rb +3 -0
- data/lib/nokogiri/css/parser.rb +8 -2
- data/lib/nokogiri/css/parser.y +7 -2
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document.rb +7 -1
- data/lib/nokogiri/xml/dtd.rb +4 -4
- data/lib/nokogiri/xml/node.rb +2 -2
- data/ports/archives/libxml2-2.9.3.tar.gz +0 -0
- data/test/css/test_parser.rb +7 -1
- data/test/files/GH_1042.html +18 -0
- data/test/files/namespace_pressure_test.xml +1684 -0
- data/test/files/tlm.html +2 -1
- data/test/html/sax/test_parser.rb +2 -2
- data/test/html/test_document.rb +18 -8
- data/test/html/test_document_encoding.rb +46 -54
- data/test/html/test_document_fragment.rb +21 -22
- data/test/html/test_node.rb +16 -0
- data/test/html/test_node_encoding.rb +12 -14
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +14 -0
- data/test/test_reader.rb +19 -0
- data/test/test_xslt_transforms.rb +5 -3
- data/test/xml/sax/test_parser.rb +36 -39
- data/test/xml/test_document.rb +7 -2
- data/test/xml/test_document_encoding.rb +14 -16
- data/test/xml/test_dtd_encoding.rb +0 -2
- data/test/xml/test_node_encoding.rb +78 -80
- data/test/xml/test_reader_encoding.rb +100 -102
- data/test/xslt/test_exception_handling.rb +1 -1
- metadata +11 -28
- data/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch +0 -29
- data/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch +0 -31
- data/patches/libxml2/0003-Stop-parsing-on-entities-boundaries-errors.patch +0 -32
- data/patches/libxml2/0004-Cleanup-conditional-section-error-handling.patch +0 -49
- data/patches/libxml2/0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch +0 -177
- data/patches/libxml2/0006-Another-variation-of-overflow-in-Conditional-section.patch +0 -32
- data/patches/libxml2/0007-Fix-an-error-in-previous-Conditional-section-patch.patch +0 -28
- data/patches/libxml2/0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch +0 -31
- data/patches/libxml2/0009-Updated-config.guess.patch +0 -397
- data/patches/libxml2/0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch +0 -64
- data/patches/libxml2/0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch +0 -35
- data/patches/libxml2/0012-Avoid-processing-entities-after-encoding-conversion-.patch +0 -83
- data/patches/libxml2/0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch +0 -33
- data/patches/libxml2/0014-CVE-2015-5312-Another-entity-expansion-issue.patch +0 -32
- data/patches/libxml2/0015-Add-xmlHaltParser-to-stop-the-parser.patch +0 -81
- data/patches/libxml2/0016-Detect-incoherency-on-GROW.patch +0 -36
- data/patches/libxml2/0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch +0 -105
- data/patches/libxml2/0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch +0 -43
- data/patches/libxml2/0019-Do-not-print-error-context-when-there-is-none.patch +0 -28
- data/patches/libxml2/0020-xmlStopParser-reset-errNo.patch +0 -41
- data/patches/libxml2/0021-Reuse-xmlHaltParser-where-it-makes-sense.patch +0 -175
- data/ports/archives/libxml2-2.9.2.tar.gz +0 -0
@@ -1,43 +0,0 @@
|
|
1
|
-
From 37bc5395ae2489db988b37b4dba070c584b516ca Mon Sep 17 00:00:00 2001
|
2
|
-
From: Hugh Davenport <hugh@allthethings.co.nz>
|
3
|
-
Date: Fri, 20 Nov 2015 17:16:06 +0800
|
4
|
-
Subject: [PATCH 18/18] CVE-2015-8242 Buffer overead with HTML parser in push
|
5
|
-
mode
|
6
|
-
|
7
|
-
For https://bugzilla.gnome.org/show_bug.cgi?id=756372
|
8
|
-
Error in the code pointing to the codepoint in the stack for the
|
9
|
-
current char value instead of the pointer in the input that the SAX
|
10
|
-
callback expects
|
11
|
-
Reported and fixed by Hugh Davenport
|
12
|
-
---
|
13
|
-
HTMLparser.c | 6 +++---
|
14
|
-
1 file changed, 3 insertions(+), 3 deletions(-)
|
15
|
-
|
16
|
-
diff --git a/HTMLparser.c b/HTMLparser.c
|
17
|
-
index bdf7807..b729197 100644
|
18
|
-
--- a/HTMLparser.c
|
19
|
-
+++ b/HTMLparser.c
|
20
|
-
@@ -5735,17 +5735,17 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
|
21
|
-
if (ctxt->keepBlanks) {
|
22
|
-
if (ctxt->sax->characters != NULL)
|
23
|
-
ctxt->sax->characters(
|
24
|
-
- ctxt->userData, &cur, 1);
|
25
|
-
+ ctxt->userData, &in->cur[0], 1);
|
26
|
-
} else {
|
27
|
-
if (ctxt->sax->ignorableWhitespace != NULL)
|
28
|
-
ctxt->sax->ignorableWhitespace(
|
29
|
-
- ctxt->userData, &cur, 1);
|
30
|
-
+ ctxt->userData, &in->cur[0], 1);
|
31
|
-
}
|
32
|
-
} else {
|
33
|
-
htmlCheckParagraph(ctxt);
|
34
|
-
if (ctxt->sax->characters != NULL)
|
35
|
-
ctxt->sax->characters(
|
36
|
-
- ctxt->userData, &cur, 1);
|
37
|
-
+ ctxt->userData, &in->cur[0], 1);
|
38
|
-
}
|
39
|
-
}
|
40
|
-
ctxt->token = 0;
|
41
|
-
--
|
42
|
-
2.5.0
|
43
|
-
|
@@ -1,28 +0,0 @@
|
|
1
|
-
From ce0b0d0d81fdbb5f722a890432b52d363e4de57b Mon Sep 17 00:00:00 2001
|
2
|
-
From: Daniel Veillard <veillard@redhat.com>
|
3
|
-
Date: Fri, 20 Nov 2015 15:01:22 +0800
|
4
|
-
Subject: Do not print error context when there is none
|
5
|
-
|
6
|
-
Which now happens more frequently du to xmlHaltParser use
|
7
|
-
---
|
8
|
-
error.c | 4 +++-
|
9
|
-
1 file changed, 3 insertions(+), 1 deletion(-)
|
10
|
-
|
11
|
-
diff --git a/error.c b/error.c
|
12
|
-
index cbcf5c9..9c45040 100644
|
13
|
-
--- a/error.c
|
14
|
-
+++ b/error.c
|
15
|
-
@@ -177,7 +177,9 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
|
16
|
-
xmlChar content[81]; /* space for 80 chars + line terminator */
|
17
|
-
xmlChar *ctnt;
|
18
|
-
|
19
|
-
- if (input == NULL) return;
|
20
|
-
+ if ((input == NULL) || (input->cur == NULL) ||
|
21
|
-
+ (*input->cur == 0)) return;
|
22
|
-
+
|
23
|
-
cur = input->cur;
|
24
|
-
base = input->base;
|
25
|
-
/* skip backwards over any end-of-lines */
|
26
|
-
--
|
27
|
-
cgit v0.11.2
|
28
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
From 53ac9c9649fa091377dfea9511f012171f08972d Mon Sep 17 00:00:00 2001
|
2
|
-
From: Daniel Veillard <veillard@redhat.com>
|
3
|
-
Date: Mon, 9 Nov 2015 18:16:00 +0800
|
4
|
-
Subject: xmlStopParser reset errNo
|
5
|
-
|
6
|
-
I had used it in contexts where that information ought to be preserved
|
7
|
-
---
|
8
|
-
parser.c | 3 +++
|
9
|
-
1 file changed, 3 insertions(+)
|
10
|
-
|
11
|
-
diff --git a/parser.c b/parser.c
|
12
|
-
index c79b4e8..b7b6668 100644
|
13
|
-
--- a/parser.c
|
14
|
-
+++ b/parser.c
|
15
|
-
@@ -6782,6 +6782,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
16
|
-
if (RAW != '[') {
|
17
|
-
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
18
|
-
xmlStopParser(ctxt);
|
19
|
-
+ ctxt->errNo = XML_ERR_CONDSEC_INVALID;
|
20
|
-
return;
|
21
|
-
} else {
|
22
|
-
if (ctxt->input->id != id) {
|
23
|
-
@@ -6844,6 +6845,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
24
|
-
if (RAW != '[') {
|
25
|
-
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
26
|
-
xmlStopParser(ctxt);
|
27
|
-
+ ctxt->errNo = XML_ERR_CONDSEC_INVALID;
|
28
|
-
return;
|
29
|
-
} else {
|
30
|
-
if (ctxt->input->id != id) {
|
31
|
-
@@ -6901,6 +6903,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
32
|
-
} else {
|
33
|
-
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
|
34
|
-
xmlStopParser(ctxt);
|
35
|
-
+ ctxt->errNo = XML_ERR_CONDSEC_INVALID_KEYWORD;
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
|
39
|
-
--
|
40
|
-
cgit v0.11.2
|
41
|
-
|
@@ -1,175 +0,0 @@
|
|
1
|
-
From e3b1597421ad7cbeb5939fc3b54f43f141c82366 Mon Sep 17 00:00:00 2001
|
2
|
-
From: Daniel Veillard <veillard@redhat.com>
|
3
|
-
Date: Fri, 20 Nov 2015 14:59:30 +0800
|
4
|
-
Subject: Reuse xmlHaltParser() where it makes sense
|
5
|
-
|
6
|
-
Unify the various place where either xmlStopParser was called
|
7
|
-
(which resets the error as a side effect) and places where we
|
8
|
-
used ctxt->instate = XML_PARSER_EOF to stop further processing
|
9
|
-
---
|
10
|
-
parser.c | 37 +++++++++++++++++--------------------
|
11
|
-
1 file changed, 17 insertions(+), 20 deletions(-)
|
12
|
-
|
13
|
-
diff --git a/parser.c b/parser.c
|
14
|
-
index b6e99b1..1810f99 100644
|
15
|
-
--- a/parser.c
|
16
|
-
+++ b/parser.c
|
17
|
-
@@ -1773,7 +1773,7 @@ nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
|
18
|
-
xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR,
|
19
|
-
"Excessive depth in document: %d use XML_PARSE_HUGE option\n",
|
20
|
-
xmlParserMaxDepth);
|
21
|
-
- ctxt->instate = XML_PARSER_EOF;
|
22
|
-
+ xmlHaltParser(ctxt);
|
23
|
-
return(-1);
|
24
|
-
}
|
25
|
-
ctxt->nodeTab[ctxt->nodeNr] = value;
|
26
|
-
@@ -5675,7 +5675,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
|
27
|
-
if (RAW != '>') {
|
28
|
-
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
|
29
|
-
"xmlParseEntityDecl: entity %s not terminated\n", name);
|
30
|
-
- xmlStopParser(ctxt);
|
31
|
-
+ xmlHaltParser(ctxt);
|
32
|
-
} else {
|
33
|
-
if (input != ctxt->input) {
|
34
|
-
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
35
|
-
@@ -6787,8 +6787,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
36
|
-
SKIP_BLANKS;
|
37
|
-
if (RAW != '[') {
|
38
|
-
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
39
|
-
- xmlStopParser(ctxt);
|
40
|
-
- ctxt->errNo = XML_ERR_CONDSEC_INVALID;
|
41
|
-
+ xmlHaltParser(ctxt);
|
42
|
-
return;
|
43
|
-
} else {
|
44
|
-
if (ctxt->input->id != id) {
|
45
|
-
@@ -6850,8 +6849,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
46
|
-
SKIP_BLANKS;
|
47
|
-
if (RAW != '[') {
|
48
|
-
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
|
49
|
-
- xmlStopParser(ctxt);
|
50
|
-
- ctxt->errNo = XML_ERR_CONDSEC_INVALID;
|
51
|
-
+ xmlHaltParser(ctxt);
|
52
|
-
return;
|
53
|
-
} else {
|
54
|
-
if (ctxt->input->id != id) {
|
55
|
-
@@ -6908,8 +6906,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
|
56
|
-
|
57
|
-
} else {
|
58
|
-
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
|
59
|
-
- xmlStopParser(ctxt);
|
60
|
-
- ctxt->errNo = XML_ERR_CONDSEC_INVALID_KEYWORD;
|
61
|
-
+ xmlHaltParser(ctxt);
|
62
|
-
return;
|
63
|
-
}
|
64
|
-
|
65
|
-
@@ -7120,7 +7117,7 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
|
66
|
-
/*
|
67
|
-
* The XML REC instructs us to stop parsing right here
|
68
|
-
*/
|
69
|
-
- ctxt->instate = XML_PARSER_EOF;
|
70
|
-
+ xmlHaltParser(ctxt);
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
@@ -8107,7 +8104,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
|
75
|
-
* The XML REC instructs us to stop parsing
|
76
|
-
* right here
|
77
|
-
*/
|
78
|
-
- ctxt->instate = XML_PARSER_EOF;
|
79
|
-
+ xmlHaltParser(ctxt);
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
@@ -10047,7 +10044,7 @@ xmlParseContent(xmlParserCtxtPtr ctxt) {
|
84
|
-
if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
|
85
|
-
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
|
86
|
-
"detected an error in element content\n");
|
87
|
-
- ctxt->instate = XML_PARSER_EOF;
|
88
|
-
+ xmlHaltParser(ctxt);
|
89
|
-
break;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
@@ -10082,7 +10079,7 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
|
93
|
-
xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR,
|
94
|
-
"Excessive depth in document: %d use XML_PARSE_HUGE option\n",
|
95
|
-
xmlParserMaxDepth);
|
96
|
-
- ctxt->instate = XML_PARSER_EOF;
|
97
|
-
+ xmlHaltParser(ctxt);
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
|
101
|
-
@@ -11412,7 +11409,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
102
|
-
ctxt->sax->setDocumentLocator(ctxt->userData,
|
103
|
-
&xmlDefaultSAXLocator);
|
104
|
-
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL);
|
105
|
-
- ctxt->instate = XML_PARSER_EOF;
|
106
|
-
+ xmlHaltParser(ctxt);
|
107
|
-
#ifdef DEBUG_PUSH
|
108
|
-
xmlGenericError(xmlGenericErrorContext,
|
109
|
-
"PP: entering EOF\n");
|
110
|
-
@@ -11445,7 +11442,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
111
|
-
* The XML REC instructs us to stop parsing right
|
112
|
-
* here
|
113
|
-
*/
|
114
|
-
- ctxt->instate = XML_PARSER_EOF;
|
115
|
-
+ xmlHaltParser(ctxt);
|
116
|
-
return(0);
|
117
|
-
}
|
118
|
-
ctxt->standalone = ctxt->input->standalone;
|
119
|
-
@@ -11501,7 +11498,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
120
|
-
cur = ctxt->input->cur[0];
|
121
|
-
if (cur != '<') {
|
122
|
-
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_EMPTY, NULL);
|
123
|
-
- ctxt->instate = XML_PARSER_EOF;
|
124
|
-
+ xmlHaltParser(ctxt);
|
125
|
-
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
126
|
-
ctxt->sax->endDocument(ctxt->userData);
|
127
|
-
goto done;
|
128
|
-
@@ -11533,7 +11530,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
129
|
-
goto done;
|
130
|
-
if (name == NULL) {
|
131
|
-
spacePop(ctxt);
|
132
|
-
- ctxt->instate = XML_PARSER_EOF;
|
133
|
-
+ xmlHaltParser(ctxt);
|
134
|
-
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
135
|
-
ctxt->sax->endDocument(ctxt->userData);
|
136
|
-
goto done;
|
137
|
-
@@ -11700,7 +11697,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
138
|
-
if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) {
|
139
|
-
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
|
140
|
-
"detected an error in element content\n");
|
141
|
-
- ctxt->instate = XML_PARSER_EOF;
|
142
|
-
+ xmlHaltParser(ctxt);
|
143
|
-
break;
|
144
|
-
}
|
145
|
-
break;
|
146
|
-
@@ -12021,7 +12018,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
147
|
-
goto done;
|
148
|
-
} else {
|
149
|
-
xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL);
|
150
|
-
- ctxt->instate = XML_PARSER_EOF;
|
151
|
-
+ xmlHaltParser(ctxt);
|
152
|
-
#ifdef DEBUG_PUSH
|
153
|
-
xmlGenericError(xmlGenericErrorContext,
|
154
|
-
"PP: entering EOF\n");
|
155
|
-
@@ -12385,7 +12382,7 @@ xmldecl_done:
|
156
|
-
res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk);
|
157
|
-
if (res < 0) {
|
158
|
-
ctxt->errNo = XML_PARSER_EOF;
|
159
|
-
- ctxt->disableSAX = 1;
|
160
|
-
+ xmlHaltParser(ctxt);
|
161
|
-
return (XML_PARSER_EOF);
|
162
|
-
}
|
163
|
-
xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur);
|
164
|
-
@@ -12439,7 +12436,7 @@ xmldecl_done:
|
165
|
-
((ctxt->input->cur - ctxt->input->base) > XML_MAX_LOOKUP_LIMIT)) &&
|
166
|
-
((ctxt->options & XML_PARSE_HUGE) == 0)) {
|
167
|
-
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup");
|
168
|
-
- ctxt->instate = XML_PARSER_EOF;
|
169
|
-
+ xmlHaltParser(ctxt);
|
170
|
-
}
|
171
|
-
if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1))
|
172
|
-
return(ctxt->errNo);
|
173
|
-
--
|
174
|
-
cgit v0.11.2
|
175
|
-
|
Binary file
|