nokogiri 1.10.2 → 1.10.10
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/dependencies.yml +28 -26
- data/ext/nokogiri/xml_schema.c +29 -0
- data/lib/nokogiri/css/tokenizer.rb +104 -103
- data/lib/nokogiri/version.rb +26 -26
- data/lib/nokogiri/xml/builder.rb +33 -30
- data/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch +25 -0
- data/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +32 -0
- data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
- metadata +34 -13
- data/ports/archives/libxml2-2.9.9.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.33.tar.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea976ad079c6e265a2275365b6572541c675b6815a8cc08b6cdd18e08f86764
|
4
|
+
data.tar.gz: 33d11553009bb7563d6594802e0de35f5c950d7df07b828c54b6411f573d4a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8b1e1b238c4a0f4354bb7358a31dbf2288cc654313267e65bbbacb996abf28eb7d40122fae3a27f0ae9a589531c6717a0f7be4660412b757a95b15e12661b30
|
7
|
+
data.tar.gz: 87769ba4a458792224e910db95258ae447714a0b732e69832d7ab643d798827e27faeafe29936067b4d07affb144dd88f6ab09de47e296c9f67b0bc4093176a8
|
data/dependencies.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
libxml2:
|
2
|
-
version: "2.9.
|
3
|
-
sha256: "
|
2
|
+
version: "2.9.10"
|
3
|
+
sha256: "aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f"
|
4
4
|
# manually verified checksum:
|
5
5
|
#
|
6
|
-
# $ gpg --verify libxml2-2.9.
|
7
|
-
# gpg: Signature made
|
8
|
-
# gpg: using RSA key
|
6
|
+
# $ gpg --verify libxml2-2.9.10.tar.gz.asc ports/archives/libxml2-2.9.10.tar.gz
|
7
|
+
# gpg: Signature made Wed 30 Oct 2019 03:15:42 PM EDT
|
8
|
+
# gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
|
9
9
|
# gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
|
10
10
|
# gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
|
11
11
|
# gpg: WARNING: This key is not certified with a trusted signature!
|
@@ -16,25 +16,26 @@ libxml2:
|
|
16
16
|
# using this pgp signature:
|
17
17
|
#
|
18
18
|
# -----BEGIN PGP SIGNATURE-----
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
19
|
+
#
|
20
|
+
# iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl254V4ACgkQFViLJllr
|
21
|
+
# 6l0ldAf6Azt4/oKDfMKRd+xaykUrb+34dr2ZRsjRDS1cnelAtL9TCWhE5lOkLI3c
|
22
|
+
# 3FyNRaLhOEOOluZmKTJYyzS42JSSHDhxGj14gIeyafOjvRhHG3h1m5GvMmvgKWkd
|
23
|
+
# qzxFrVFSG26iWJxMvxIA88t7M+QHb7ff7xR29ETJscewEmAd3LmZITglK02lWeGz
|
24
|
+
# LfxfLuakM6RnCUu0dzacJKO0nMOKju+RL/N9bciI/UOhNYEkWqPnzC0GzbvFLqDu
|
25
|
+
# rM+OvCSewSTziiejpdrUwYXkY5Ui2+cxUbacLauEr8iRLg7xXKqv27NORE4yeQcS
|
26
|
+
# LgIhxG/qSNfihMS6E1ZO5bK2DbGCZQ==
|
27
|
+
# =ZNuc
|
27
28
|
# -----END PGP SIGNATURE-----
|
28
29
|
#
|
29
30
|
|
30
31
|
libxslt:
|
31
|
-
version: "1.1.
|
32
|
-
sha256: "
|
32
|
+
version: "1.1.34"
|
33
|
+
sha256: "98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7f93f7f"
|
33
34
|
# manually verified checksum:
|
34
35
|
#
|
35
|
-
# $ gpg --verify libxslt-1.1.
|
36
|
-
# gpg: Signature made
|
37
|
-
# gpg: using RSA key
|
36
|
+
# $ gpg --verify ~/Downloads/libxslt-1.1.34.tar.gz.asc ports/archives/libxslt-1.1.34.tar.gz
|
37
|
+
# gpg: Signature made Wed 30 Oct 2019 04:02:48 PM EDT
|
38
|
+
# gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
|
38
39
|
# gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
|
39
40
|
# gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
|
40
41
|
# gpg: WARNING: This key is not certified with a trusted signature!
|
@@ -45,14 +46,15 @@ libxslt:
|
|
45
46
|
# using this pgp signature:
|
46
47
|
#
|
47
48
|
# -----BEGIN PGP SIGNATURE-----
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
49
|
+
#
|
50
|
+
# iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl257GgACgkQFViLJllr
|
51
|
+
# 6l2vVggAjJEHmASiS56SxhPOsGqbfBihM66gQFoIymQfMu2430N1GSTkLsfbkJO8
|
52
|
+
# 8yBX11NjzK/m9uxwshMW3rVCU7EpL3PUimN3reXdPiQj9hAOAWF1V3BZNevbQC2E
|
53
|
+
# FCIraioukaidf8sjUG4/sGpK/gOcP/3hYoN0HUoBigCNJjDqhijxM3M3GJJtCASp
|
54
|
+
# jL4CQbs2OmxW8ixOZbuWEESvFFHUgYRsdZjRVN+GRfSOvJjxypurmYwQ3RjO7JxL
|
55
|
+
# 2FY8qKQ+xpeID8NV8F5OUEvWBjk1QS133VTqBZNlONdnEtV/og6jNu5k0O/Kvhup
|
56
|
+
# caR+8TMErOcLr9OgDklO6DoYyAsf9Q==
|
57
|
+
# =g4i4
|
56
58
|
# -----END PGP SIGNATURE-----
|
57
59
|
#
|
58
60
|
|
data/ext/nokogiri/xml_schema.c
CHANGED
@@ -133,6 +133,31 @@ static VALUE read_memory(VALUE klass, VALUE content)
|
|
133
133
|
return rb_schema;
|
134
134
|
}
|
135
135
|
|
136
|
+
/* Schema creation will remove and deallocate "blank" nodes.
|
137
|
+
* If those blank nodes have been exposed to Ruby, they could get freed
|
138
|
+
* out from under the VALUE pointer. This function checks to see if any of
|
139
|
+
* those nodes have been exposed to Ruby, and if so we should raise an exception.
|
140
|
+
*/
|
141
|
+
static int has_blank_nodes_p(VALUE cache)
|
142
|
+
{
|
143
|
+
long i;
|
144
|
+
|
145
|
+
if (NIL_P(cache)) {
|
146
|
+
return 0;
|
147
|
+
}
|
148
|
+
|
149
|
+
for (i = 0; i < RARRAY_LEN(cache); i++) {
|
150
|
+
xmlNodePtr node;
|
151
|
+
VALUE element = rb_ary_entry(cache, i);
|
152
|
+
Data_Get_Struct(element, xmlNode, node);
|
153
|
+
if (xmlIsBlankNode(node)) {
|
154
|
+
return 1;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
return 0;
|
159
|
+
}
|
160
|
+
|
136
161
|
/*
|
137
162
|
* call-seq:
|
138
163
|
* from_document(doc)
|
@@ -152,6 +177,10 @@ static VALUE from_document(VALUE klass, VALUE document)
|
|
152
177
|
/* In case someone passes us a node. ugh. */
|
153
178
|
doc = doc->doc;
|
154
179
|
|
180
|
+
if (has_blank_nodes_p(DOC_NODE_CACHE(doc))) {
|
181
|
+
rb_raise(rb_eArgError, "Creating a schema from a document that has blank nodes exposed to Ruby is dangerous");
|
182
|
+
}
|
183
|
+
|
155
184
|
ctx = xmlSchemaNewDocParserCtxt(doc);
|
156
185
|
|
157
186
|
errors = rb_ary_new();
|
@@ -1,151 +1,152 @@
|
|
1
1
|
#--
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by rex 1.0.
|
3
|
+
# This file is automatically generated by rex 1.0.7
|
4
4
|
# from lexical definition file "lib/nokogiri/css/tokenizer.rex".
|
5
5
|
#++
|
6
6
|
|
7
7
|
module Nokogiri
|
8
8
|
module CSS
|
9
9
|
class Tokenizer # :nodoc:
|
10
|
-
|
10
|
+
require 'strscan'
|
11
11
|
|
12
|
-
|
12
|
+
class ScanError < StandardError ; end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
attr_reader :lineno
|
15
|
+
attr_reader :filename
|
16
|
+
attr_accessor :state
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def scan_setup(str)
|
19
|
+
@ss = StringScanner.new(str)
|
20
|
+
@lineno = 1
|
21
|
+
@state = nil
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def action
|
25
|
+
yield
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
def scan_str(str)
|
29
|
+
scan_setup(str)
|
30
|
+
do_parse
|
31
|
+
end
|
32
|
+
alias :scan :scan_str
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
def load_file( filename )
|
35
|
+
@filename = filename
|
36
|
+
File.open(filename, "r") do |f|
|
37
|
+
scan_setup(f.read)
|
38
|
+
end
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def scan_file( filename )
|
42
|
+
load_file(filename)
|
43
|
+
do_parse
|
44
|
+
end
|
45
45
|
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
# skips empty actions
|
51
|
-
until token = _next_token or @ss.eos?; end
|
52
|
-
token
|
53
|
-
end
|
47
|
+
def next_token
|
48
|
+
return if @ss.eos?
|
54
49
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
when nil
|
60
|
-
case
|
61
|
-
when (text = @ss.scan(/has\([\s]*/))
|
62
|
-
action { [:HAS, text] }
|
50
|
+
# skips empty actions
|
51
|
+
until token = _next_token or @ss.eos?; end
|
52
|
+
token
|
53
|
+
end
|
63
54
|
|
64
|
-
|
65
|
-
|
55
|
+
def _next_token
|
56
|
+
text = @ss.peek(1)
|
57
|
+
@lineno += 1 if text == "\n"
|
58
|
+
token = case @state
|
59
|
+
when nil
|
60
|
+
case
|
61
|
+
when (text = @ss.scan(/has\([\s]*/))
|
62
|
+
action { [:HAS, text] }
|
66
63
|
|
67
|
-
|
68
|
-
|
64
|
+
when (text = @ss.scan(/[-@]?([_A-Za-z]|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])([_A-Za-z0-9-]|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])*\([\s]*/))
|
65
|
+
action { [:FUNCTION, text] }
|
69
66
|
|
70
|
-
|
71
|
-
|
67
|
+
when (text = @ss.scan(/[-@]?([_A-Za-z]|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])([_A-Za-z0-9-]|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])*/))
|
68
|
+
action { [:IDENT, text] }
|
72
69
|
|
73
|
-
|
74
|
-
|
70
|
+
when (text = @ss.scan(/\#([_A-Za-z0-9-]|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])+/))
|
71
|
+
action { [:HASH, text] }
|
75
72
|
|
76
|
-
|
77
|
-
|
73
|
+
when (text = @ss.scan(/[\s]*~=[\s]*/))
|
74
|
+
action { [:INCLUDES, text] }
|
78
75
|
|
79
|
-
|
80
|
-
|
76
|
+
when (text = @ss.scan(/[\s]*\|=[\s]*/))
|
77
|
+
action { [:DASHMATCH, text] }
|
81
78
|
|
82
|
-
|
83
|
-
|
79
|
+
when (text = @ss.scan(/[\s]*\^=[\s]*/))
|
80
|
+
action { [:PREFIXMATCH, text] }
|
84
81
|
|
85
|
-
|
86
|
-
|
82
|
+
when (text = @ss.scan(/[\s]*\$=[\s]*/))
|
83
|
+
action { [:SUFFIXMATCH, text] }
|
87
84
|
|
88
|
-
|
89
|
-
|
85
|
+
when (text = @ss.scan(/[\s]*\*=[\s]*/))
|
86
|
+
action { [:SUBSTRINGMATCH, text] }
|
90
87
|
|
91
|
-
|
92
|
-
|
88
|
+
when (text = @ss.scan(/[\s]*!=[\s]*/))
|
89
|
+
action { [:NOT_EQUAL, text] }
|
93
90
|
|
94
|
-
|
95
|
-
|
91
|
+
when (text = @ss.scan(/[\s]*=[\s]*/))
|
92
|
+
action { [:EQUAL, text] }
|
96
93
|
|
97
|
-
|
98
|
-
|
94
|
+
when (text = @ss.scan(/[\s]*\)/))
|
95
|
+
action { [:RPAREN, text] }
|
99
96
|
|
100
|
-
|
101
|
-
|
97
|
+
when (text = @ss.scan(/\[[\s]*/))
|
98
|
+
action { [:LSQUARE, text] }
|
102
99
|
|
103
|
-
|
104
|
-
|
100
|
+
when (text = @ss.scan(/[\s]*\]/))
|
101
|
+
action { [:RSQUARE, text] }
|
105
102
|
|
106
|
-
|
107
|
-
|
103
|
+
when (text = @ss.scan(/[\s]*\+[\s]*/))
|
104
|
+
action { [:PLUS, text] }
|
108
105
|
|
109
|
-
|
110
|
-
|
106
|
+
when (text = @ss.scan(/[\s]*>[\s]*/))
|
107
|
+
action { [:GREATER, text] }
|
111
108
|
|
112
|
-
|
113
|
-
|
109
|
+
when (text = @ss.scan(/[\s]*,[\s]*/))
|
110
|
+
action { [:COMMA, text] }
|
114
111
|
|
115
|
-
|
116
|
-
|
112
|
+
when (text = @ss.scan(/[\s]*~[\s]*/))
|
113
|
+
action { [:TILDE, text] }
|
117
114
|
|
118
|
-
|
119
|
-
|
115
|
+
when (text = @ss.scan(/\:not\([\s]*/))
|
116
|
+
action { [:NOT, text] }
|
120
117
|
|
121
|
-
|
122
|
-
|
118
|
+
when (text = @ss.scan(/-?([0-9]+|[0-9]*\.[0-9]+)/))
|
119
|
+
action { [:NUMBER, text] }
|
123
120
|
|
124
|
-
|
125
|
-
|
121
|
+
when (text = @ss.scan(/[\s]*\/\/[\s]*/))
|
122
|
+
action { [:DOUBLESLASH, text] }
|
126
123
|
|
127
|
-
|
128
|
-
|
124
|
+
when (text = @ss.scan(/[\s]*\/[\s]*/))
|
125
|
+
action { [:SLASH, text] }
|
129
126
|
|
130
|
-
|
131
|
-
|
127
|
+
when (text = @ss.scan(/U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?/))
|
128
|
+
action {[:UNICODE_RANGE, text] }
|
132
129
|
|
133
|
-
|
134
|
-
|
130
|
+
when (text = @ss.scan(/[\s]+/))
|
131
|
+
action { [:S, text] }
|
135
132
|
|
136
|
-
|
137
|
-
|
133
|
+
when (text = @ss.scan(/"([^\n\r\f"]|\n|\r\n|\r|\f|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])*(?<!\\)(?:\\{2})*"|'([^\n\r\f']|\n|\r\n|\r|\f|[^\0-\177]|\\[0-9A-Fa-f]{1,6}(\r\n|[\s])?|\\[^\n\r\f0-9A-Fa-f])*(?<!\\)(?:\\{2})*'/))
|
134
|
+
action { [:STRING, text] }
|
138
135
|
|
139
|
-
|
140
|
-
|
141
|
-
raise ScanError, "can not match: '" + text + "'"
|
142
|
-
end # if
|
136
|
+
when (text = @ss.scan(/./))
|
137
|
+
action { [text, text] }
|
143
138
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
139
|
+
|
140
|
+
else
|
141
|
+
text = @ss.string[@ss.pos .. -1]
|
142
|
+
raise ScanError, "can not match: '" + text + "'"
|
143
|
+
end # if
|
144
|
+
|
145
|
+
else
|
146
|
+
raise ScanError, "undefined state: '" + state.to_s + "'"
|
147
|
+
end # case state
|
148
|
+
token
|
149
|
+
end # def _next_token
|
149
150
|
|
150
151
|
end # class
|
151
152
|
end
|
data/lib/nokogiri/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Nokogiri
|
2
2
|
# The version of Nokogiri you are using
|
3
|
-
VERSION = "1.10.
|
3
|
+
VERSION = "1.10.10"
|
4
4
|
|
5
5
|
class VersionInfo # :nodoc:
|
6
6
|
def jruby?
|
@@ -8,7 +8,7 @@ module Nokogiri
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def engine
|
11
|
-
defined?(RUBY_ENGINE) ? RUBY_ENGINE :
|
11
|
+
defined?(RUBY_ENGINE) ? RUBY_ENGINE : "mri"
|
12
12
|
end
|
13
13
|
|
14
14
|
def loaded_parser_version
|
@@ -27,7 +27,7 @@ module Nokogiri
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def libxml2_using_system?
|
30
|
-
!
|
30
|
+
!libxml2_using_packaged?
|
31
31
|
end
|
32
32
|
|
33
33
|
def libxml2_using_packaged?
|
@@ -46,33 +46,33 @@ module Nokogiri
|
|
46
46
|
|
47
47
|
def to_hash
|
48
48
|
hash_info = {}
|
49
|
-
hash_info[
|
50
|
-
hash_info[
|
51
|
-
hash_info[
|
52
|
-
hash_info[
|
53
|
-
hash_info[
|
54
|
-
hash_info[
|
55
|
-
hash_info[
|
56
|
-
hash_info[
|
49
|
+
hash_info["warnings"] = []
|
50
|
+
hash_info["nokogiri"] = Nokogiri::VERSION
|
51
|
+
hash_info["ruby"] = {}
|
52
|
+
hash_info["ruby"]["version"] = ::RUBY_VERSION
|
53
|
+
hash_info["ruby"]["platform"] = ::RUBY_PLATFORM
|
54
|
+
hash_info["ruby"]["description"] = ::RUBY_DESCRIPTION
|
55
|
+
hash_info["ruby"]["engine"] = engine
|
56
|
+
hash_info["ruby"]["jruby"] = jruby? if jruby?
|
57
57
|
|
58
58
|
if libxml2?
|
59
|
-
hash_info[
|
60
|
-
hash_info[
|
59
|
+
hash_info["libxml"] = {}
|
60
|
+
hash_info["libxml"]["binding"] = "extension"
|
61
61
|
if libxml2_using_packaged?
|
62
|
-
hash_info[
|
63
|
-
hash_info[
|
64
|
-
hash_info[
|
65
|
-
hash_info[
|
66
|
-
hash_info[
|
62
|
+
hash_info["libxml"]["source"] = "packaged"
|
63
|
+
hash_info["libxml"]["libxml2_path"] = NOKOGIRI_LIBXML2_PATH
|
64
|
+
hash_info["libxml"]["libxslt_path"] = NOKOGIRI_LIBXSLT_PATH
|
65
|
+
hash_info["libxml"]["libxml2_patches"] = NOKOGIRI_LIBXML2_PATCHES
|
66
|
+
hash_info["libxml"]["libxslt_patches"] = NOKOGIRI_LIBXSLT_PATCHES
|
67
67
|
else
|
68
|
-
hash_info[
|
68
|
+
hash_info["libxml"]["source"] = "system"
|
69
69
|
end
|
70
|
-
hash_info[
|
71
|
-
hash_info[
|
72
|
-
hash_info[
|
70
|
+
hash_info["libxml"]["compiled"] = compiled_parser_version
|
71
|
+
hash_info["libxml"]["loaded"] = loaded_parser_version
|
72
|
+
hash_info["warnings"] = warnings
|
73
73
|
elsif jruby?
|
74
|
-
hash_info[
|
75
|
-
hash_info[
|
74
|
+
hash_info["xerces"] = Nokogiri::XERCES_VERSION
|
75
|
+
hash_info["nekohtml"] = Nokogiri::NEKO_VERSION
|
76
76
|
end
|
77
77
|
|
78
78
|
hash_info
|
@@ -80,10 +80,10 @@ module Nokogiri
|
|
80
80
|
|
81
81
|
def to_markdown
|
82
82
|
begin
|
83
|
-
require
|
83
|
+
require "psych"
|
84
84
|
rescue LoadError
|
85
85
|
end
|
86
|
-
require
|
86
|
+
require "yaml"
|
87
87
|
"# Nokogiri (#{Nokogiri::VERSION})\n" +
|
88
88
|
YAML.dump(to_hash).each_line.map { |line| " #{line}" }.join
|
89
89
|
end
|
data/lib/nokogiri/xml/builder.rb
CHANGED
@@ -213,7 +213,7 @@ module Nokogiri
|
|
213
213
|
# xml.foo
|
214
214
|
# end
|
215
215
|
# end
|
216
|
-
#
|
216
|
+
#
|
217
217
|
# puts builder.to_xml
|
218
218
|
#
|
219
219
|
# Will output this xml:
|
@@ -250,7 +250,7 @@ module Nokogiri
|
|
250
250
|
# xml.awesome # add the "awesome" tag below "some_tag"
|
251
251
|
# end
|
252
252
|
#
|
253
|
-
def self.with
|
253
|
+
def self.with(root, &block)
|
254
254
|
new({}, root, &block)
|
255
255
|
end
|
256
256
|
|
@@ -263,23 +263,25 @@ module Nokogiri
|
|
263
263
|
# Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
|
264
264
|
# ...
|
265
265
|
# end
|
266
|
-
def initialize
|
267
|
-
|
266
|
+
def initialize(options = {}, root = nil, &block)
|
268
267
|
if root
|
269
|
-
@doc
|
268
|
+
@doc = root.document
|
270
269
|
@parent = root
|
271
270
|
else
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
271
|
+
klassname = "::" + (self.class.name.split("::")[0..-2] + ["Document"]).join("::")
|
272
|
+
klass = begin
|
273
|
+
Object.const_get(klassname)
|
274
|
+
rescue NameError
|
275
|
+
Nokogiri::XML::Document
|
276
|
+
end
|
277
|
+
@parent = @doc = klass.new
|
276
278
|
end
|
277
279
|
|
278
|
-
@context
|
279
|
-
@arity
|
280
|
-
@ns
|
280
|
+
@context = nil
|
281
|
+
@arity = nil
|
282
|
+
@ns = nil
|
281
283
|
|
282
|
-
options.each do |k,v|
|
284
|
+
options.each do |k, v|
|
283
285
|
@doc.send(:"#{k}=", v)
|
284
286
|
end
|
285
287
|
|
@@ -287,7 +289,7 @@ module Nokogiri
|
|
287
289
|
|
288
290
|
@arity = block.arity
|
289
291
|
if @arity <= 0
|
290
|
-
@context = eval(
|
292
|
+
@context = eval("self", block.binding)
|
291
293
|
instance_eval(&block)
|
292
294
|
else
|
293
295
|
yield self
|
@@ -298,26 +300,26 @@ module Nokogiri
|
|
298
300
|
|
299
301
|
###
|
300
302
|
# Create a Text Node with content of +string+
|
301
|
-
def text
|
303
|
+
def text(string)
|
302
304
|
insert @doc.create_text_node(string)
|
303
305
|
end
|
304
306
|
|
305
307
|
###
|
306
308
|
# Create a CDATA Node with content of +string+
|
307
|
-
def cdata
|
309
|
+
def cdata(string)
|
308
310
|
insert doc.create_cdata(string)
|
309
311
|
end
|
310
312
|
|
311
313
|
###
|
312
314
|
# Create a Comment Node with content of +string+
|
313
|
-
def comment
|
315
|
+
def comment(string)
|
314
316
|
insert doc.create_comment(string)
|
315
317
|
end
|
316
318
|
|
317
319
|
###
|
318
320
|
# Build a tag that is associated with namespace +ns+. Raises an
|
319
321
|
# ArgumentError if +ns+ has not been defined higher in the tree.
|
320
|
-
def []
|
322
|
+
def [](ns)
|
321
323
|
if @parent != @doc
|
322
324
|
@ns = @parent.namespace_definitions.find { |x| x.prefix == ns.to_s }
|
323
325
|
end
|
@@ -348,15 +350,15 @@ module Nokogiri
|
|
348
350
|
|
349
351
|
###
|
350
352
|
# Append the given raw XML +string+ to the document
|
351
|
-
def <<
|
353
|
+
def <<(string)
|
352
354
|
@doc.fragment(string).children.each { |x| insert(x) }
|
353
355
|
end
|
354
356
|
|
355
|
-
def method_missing
|
357
|
+
def method_missing(method, *args, &block) # :nodoc:
|
356
358
|
if @context && @context.respond_to?(method)
|
357
359
|
@context.send(method, *args, &block)
|
358
360
|
else
|
359
|
-
node = @doc.create_element(method.to_s.sub(/[_!]$/,
|
361
|
+
node = @doc.create_element(method.to_s.sub(/[_!]$/, ""), *args) { |n|
|
360
362
|
# Set up the namespace
|
361
363
|
if @ns.is_a? Nokogiri::XML::Namespace
|
362
364
|
n.namespace = @ns
|
@@ -377,13 +379,14 @@ module Nokogiri
|
|
377
379
|
end
|
378
380
|
|
379
381
|
private
|
382
|
+
|
380
383
|
###
|
381
384
|
# Insert +node+ as a child of the current Node
|
382
385
|
def insert(node, &block)
|
383
386
|
node = @parent.add_child(node)
|
384
387
|
if block_given?
|
385
388
|
old_parent = @parent
|
386
|
-
@parent
|
389
|
+
@parent = node
|
387
390
|
@arity ||= block.arity
|
388
391
|
if @arity <= 0
|
389
392
|
instance_eval(&block)
|
@@ -396,16 +399,16 @@ module Nokogiri
|
|
396
399
|
end
|
397
400
|
|
398
401
|
class NodeBuilder # :nodoc:
|
399
|
-
def initialize
|
402
|
+
def initialize(node, doc_builder)
|
400
403
|
@node = node
|
401
404
|
@doc_builder = doc_builder
|
402
405
|
end
|
403
406
|
|
404
|
-
def []=
|
407
|
+
def []=(k, v)
|
405
408
|
@node[k] = v
|
406
409
|
end
|
407
410
|
|
408
|
-
def []
|
411
|
+
def [](k)
|
409
412
|
@node[k]
|
410
413
|
end
|
411
414
|
|
@@ -413,19 +416,19 @@ module Nokogiri
|
|
413
416
|
opts = args.last.is_a?(Hash) ? args.pop : {}
|
414
417
|
case method.to_s
|
415
418
|
when /^(.*)!$/
|
416
|
-
@node[
|
419
|
+
@node["id"] = $1
|
417
420
|
@node.content = args.first if args.first
|
418
421
|
when /^(.*)=/
|
419
422
|
@node[$1] = args.first
|
420
423
|
else
|
421
|
-
@node[
|
422
|
-
((@node[
|
424
|
+
@node["class"] =
|
425
|
+
((@node["class"] || "").split(/\s/) + [method.to_s]).join(" ")
|
423
426
|
@node.content = args.first if args.first
|
424
427
|
end
|
425
428
|
|
426
429
|
# Assign any extra options
|
427
|
-
opts.each do |k,v|
|
428
|
-
@node[k.to_s] = ((@node[k.to_s] ||
|
430
|
+
opts.each do |k, v|
|
431
|
+
@node[k.to_s] = ((@node[k.to_s] || "").split(/\s/) + [v]).join(" ")
|
429
432
|
end
|
430
433
|
|
431
434
|
if block_given?
|
@@ -0,0 +1,25 @@
|
|
1
|
+
From 0b6ae484761fa01242fe8b67b54e3eb2d282d83d Mon Sep 17 00:00:00 2001
|
2
|
+
From: Mike Dalessio <mike.dalessio@gmail.com>
|
3
|
+
Date: Wed, 4 Dec 2019 08:43:51 -0500
|
4
|
+
Subject: [PATCH] fix libxml2.la's path
|
5
|
+
|
6
|
+
---
|
7
|
+
Makefile.in | 2 +-
|
8
|
+
1 file changed, 1 insertion(+), 1 deletion(-)
|
9
|
+
|
10
|
+
diff --git a/Makefile.in b/Makefile.in
|
11
|
+
index cf96d41..1372d8b 100644
|
12
|
+
--- a/Makefile.in
|
13
|
+
+++ b/Makefile.in
|
14
|
+
@@ -1057,7 +1057,7 @@ clean-noinstLTLIBRARIES:
|
15
|
+
rm -f $${locs}; \
|
16
|
+
}
|
17
|
+
|
18
|
+
-libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
|
19
|
+
+$(top_builddir)/libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
|
20
|
+
$(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
|
21
|
+
|
22
|
+
testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES) $(EXTRA_testdso_la_DEPENDENCIES)
|
23
|
+
--
|
24
|
+
2.17.1
|
25
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
From 0e1a49c8907645d2e155f0d89d4d9895ac5112b5 Mon Sep 17 00:00:00 2001
|
2
|
+
From: Zhipeng Xie <xiezhipeng1@huawei.com>
|
3
|
+
Date: Thu, 12 Dec 2019 17:30:55 +0800
|
4
|
+
Subject: [PATCH] Fix infinite loop in xmlStringLenDecodeEntities
|
5
|
+
|
6
|
+
When ctxt->instate == XML_PARSER_EOF,xmlParseStringEntityRef
|
7
|
+
return NULL which cause a infinite loop in xmlStringLenDecodeEntities
|
8
|
+
|
9
|
+
Found with libFuzzer.
|
10
|
+
|
11
|
+
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
|
12
|
+
---
|
13
|
+
parser.c | 3 ++-
|
14
|
+
1 file changed, 2 insertions(+), 1 deletion(-)
|
15
|
+
|
16
|
+
diff --git a/parser.c b/parser.c
|
17
|
+
index d1c3196..a34bb6c 100644
|
18
|
+
--- a/parser.c
|
19
|
+
+++ b/parser.c
|
20
|
+
@@ -2646,7 +2646,8 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
|
21
|
+
else
|
22
|
+
c = 0;
|
23
|
+
while ((c != 0) && (c != end) && /* non input consuming loop */
|
24
|
+
- (c != end2) && (c != end3)) {
|
25
|
+
+ (c != end2) && (c != end3) &&
|
26
|
+
+ (ctxt->instate != XML_PARSER_EOF)) {
|
27
|
+
|
28
|
+
if (c == 0) break;
|
29
|
+
if ((c == '&') && (str[1] == '#')) {
|
30
|
+
--
|
31
|
+
2.17.1
|
32
|
+
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2020-07-06 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: mini_portile2
|
@@ -148,28 +148,28 @@ dependencies:
|
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 1.0
|
151
|
+
version: 1.1.0
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 1.0
|
158
|
+
version: 1.1.0
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: rake-compiler-dock
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: '1.0'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
172
|
+
version: '1.0'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: rexical
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,20 @@ dependencies:
|
|
184
184
|
- - "~>"
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: 1.0.5
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: rubocop
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0.73'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0.73'
|
187
201
|
- !ruby/object:Gem::Dependency
|
188
202
|
name: simplecov
|
189
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,14 +238,14 @@ dependencies:
|
|
224
238
|
requirements:
|
225
239
|
- - "~>"
|
226
240
|
- !ruby/object:Gem::Version
|
227
|
-
version: '3.
|
241
|
+
version: '3.22'
|
228
242
|
type: :development
|
229
243
|
prerelease: false
|
230
244
|
version_requirements: !ruby/object:Gem::Requirement
|
231
245
|
requirements:
|
232
246
|
- - "~>"
|
233
247
|
- !ruby/object:Gem::Version
|
234
|
-
version: '3.
|
248
|
+
version: '3.22'
|
235
249
|
description: |-
|
236
250
|
Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
|
237
251
|
Nokogiri's many features is the ability to search documents via XPath
|
@@ -428,12 +442,19 @@ files:
|
|
428
442
|
- patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
|
429
443
|
- patches/libxml2/0002-Remove-script-macro-support.patch
|
430
444
|
- patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch
|
431
|
-
-
|
432
|
-
-
|
433
|
-
|
445
|
+
- patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch
|
446
|
+
- patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
|
447
|
+
- ports/archives/libxml2-2.9.10.tar.gz
|
448
|
+
- ports/archives/libxslt-1.1.34.tar.gz
|
449
|
+
homepage: https://nokogiri.org
|
434
450
|
licenses:
|
435
451
|
- MIT
|
436
|
-
metadata:
|
452
|
+
metadata:
|
453
|
+
homepage_uri: https://nokogiri.org
|
454
|
+
bug_tracker_uri: https://github.com/sparklemotion/nokogiri/issues
|
455
|
+
documentation_uri: https://nokogiri.org/rdoc/index.html
|
456
|
+
changelog_uri: https://nokogiri.org/CHANGELOG.html
|
457
|
+
source_code_uri: https://github.com/sparklemotion/nokogiri
|
437
458
|
post_install_message:
|
438
459
|
rdoc_options:
|
439
460
|
- "--main"
|
@@ -451,7 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
451
472
|
- !ruby/object:Gem::Version
|
452
473
|
version: '0'
|
453
474
|
requirements: []
|
454
|
-
rubygems_version: 3.0.
|
475
|
+
rubygems_version: 3.0.8
|
455
476
|
signing_key:
|
456
477
|
specification_version: 4
|
457
478
|
summary: Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser
|
Binary file
|
Binary file
|