nokogiri 1.11.0.rc1 → 1.11.0.rc2

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.

@@ -12,7 +12,9 @@ module Nokogiri
12
12
  # Regular expression used by Searchable#search to determine if a query
13
13
  # string is CSS or XPath
14
14
  LOOKS_LIKE_XPATH = /^(\.\/|\/|\.\.|\.$)/
15
-
15
+
16
+ # @!group Searching via XPath or CSS Queries
17
+
16
18
  ###
17
19
  # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
18
20
  #
@@ -46,7 +48,7 @@ module Nokogiri
46
48
  # )
47
49
  #
48
50
  # See Searchable#xpath and Searchable#css for further usage help.
49
- def search *args
51
+ def search(*args)
50
52
  paths, handler, ns, binds = extract_params(args)
51
53
 
52
54
  xpaths = paths.map(&:to_s).map do |path|
@@ -55,6 +57,7 @@ module Nokogiri
55
57
 
56
58
  xpath(*(xpaths + [ns, handler, binds].compact))
57
59
  end
60
+
58
61
  alias :/ :search
59
62
 
60
63
  ###
@@ -64,9 +67,10 @@ module Nokogiri
64
67
  # result. +paths+ must be one or more XPath or CSS queries.
65
68
  #
66
69
  # See Searchable#search for more information.
67
- def at *args
70
+ def at(*args)
68
71
  search(*args).first
69
72
  end
73
+
70
74
  alias :% :at
71
75
 
72
76
  ###
@@ -102,7 +106,7 @@ module Nokogiri
102
106
  # found in an XML document, where tags names are case-sensitive
103
107
  # (e.g., "H1" is distinct from "h1").
104
108
  #
105
- def css *args
109
+ def css(*args)
106
110
  rules, handler, ns, _ = extract_params(args)
107
111
 
108
112
  css_internal self, rules, handler, ns
@@ -115,7 +119,7 @@ module Nokogiri
115
119
  # match. +rules+ must be one or more CSS selectors.
116
120
  #
117
121
  # See Searchable#css for more information.
118
- def at_css *args
122
+ def at_css(*args)
119
123
  css(*args).first
120
124
  end
121
125
 
@@ -149,7 +153,7 @@ module Nokogiri
149
153
  # end
150
154
  # }.new)
151
155
  #
152
- def xpath *args
156
+ def xpath(*args)
153
157
  paths, handler, ns, binds = extract_params(args)
154
158
 
155
159
  xpath_internal self, paths, handler, ns, binds
@@ -162,17 +166,19 @@ module Nokogiri
162
166
  # match. +paths+ must be one or more XPath queries.
163
167
  #
164
168
  # See Searchable#xpath for more information.
165
- def at_xpath *args
169
+ def at_xpath(*args)
166
170
  xpath(*args).first
167
171
  end
168
172
 
173
+ # @!endgroup
174
+
169
175
  private
170
176
 
171
- def css_internal node, rules, handler, ns
177
+ def css_internal(node, rules, handler, ns)
172
178
  xpath_internal node, css_rules_to_xpath(rules, ns), handler, ns, nil
173
179
  end
174
180
 
175
- def xpath_internal node, paths, handler, ns, binds
181
+ def xpath_internal(node, paths, handler, ns, binds)
176
182
  document = node.document
177
183
  return NodeSet.new(document) unless document
178
184
 
@@ -187,12 +193,12 @@ module Nokogiri
187
193
  end
188
194
  end
189
195
 
190
- def xpath_impl node, path, handler, ns, binds
196
+ def xpath_impl(node, path, handler, ns, binds)
191
197
  ctx = XPathContext.new(node)
192
198
  ctx.register_namespaces(ns)
193
- path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml?
199
+ path = path.gsub(/xmlns:/, " :") unless Nokogiri.uses_libxml?
194
200
 
195
- binds.each do |key,value|
201
+ binds.each do |key, value|
196
202
  ctx.register_variable key.to_s, value
197
203
  end if binds
198
204
 
@@ -203,13 +209,13 @@ module Nokogiri
203
209
  rules.map { |rule| xpath_query_from_css_rule(rule, ns) }
204
210
  end
205
211
 
206
- def xpath_query_from_css_rule rule, ns
212
+ def xpath_query_from_css_rule(rule, ns)
207
213
  self.class::IMPLIED_XPATH_CONTEXTS.map do |implied_xpath_context|
208
214
  CSS.xpath_for(rule.to_s, :prefix => implied_xpath_context, :ns => ns)
209
- end.join(' | ')
215
+ end.join(" | ")
210
216
  end
211
217
 
212
- def extract_params params # :nodoc:
218
+ def extract_params(params) # :nodoc:
213
219
  handler = params.find do |param|
214
220
  ![Hash, String, Symbol].include?(param.class)
215
221
  end
@@ -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
+
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.11.0.rc1
4
+ version: 1.11.0.rc2
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: 2020-02-02 00:00:00.000000000 Z
17
+ date: 2020-04-01 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: mini_portile2
@@ -22,42 +22,48 @@ dependencies:
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 2.4.0
25
+ version: 2.5.0
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 2.4.0
32
+ version: 2.5.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: concourse
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.30'
39
+ version: '0.32'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.30'
46
+ version: '0.32'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '3.18'
53
+ version: '3.22'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.22.1
54
57
  type: :development
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
61
  - - "~>"
59
62
  - !ruby/object:Gem::Version
60
- version: '3.18'
63
+ version: '3.22'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.22.1
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: hoe-bundler
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -444,6 +450,7 @@ files:
444
450
  - patches/libxml2/0002-Remove-script-macro-support.patch
445
451
  - patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch
446
452
  - patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch
453
+ - patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
447
454
  - ports/archives/libxml2-2.9.10.tar.gz
448
455
  - ports/archives/libxslt-1.1.34.tar.gz
449
456
  homepage: https://nokogiri.org