nokogiri 1.10.4 → 1.11.2

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.

Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/LICENSE-DEPENDENCIES.md +1015 -947
  4. data/LICENSE.md +1 -1
  5. data/README.md +173 -94
  6. data/dependencies.yml +28 -26
  7. data/ext/nokogiri/depend +37 -358
  8. data/ext/nokogiri/extconf.rb +611 -391
  9. data/ext/nokogiri/html_document.c +78 -82
  10. data/ext/nokogiri/html_element_description.c +84 -71
  11. data/ext/nokogiri/html_entity_lookup.c +21 -16
  12. data/ext/nokogiri/html_sax_parser_context.c +69 -66
  13. data/ext/nokogiri/html_sax_push_parser.c +42 -34
  14. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  15. data/ext/nokogiri/nokogiri.c +192 -87
  16. data/ext/nokogiri/nokogiri.h +181 -89
  17. data/ext/nokogiri/test_global_handlers.c +40 -0
  18. data/ext/nokogiri/xml_attr.c +15 -15
  19. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  20. data/ext/nokogiri/xml_cdata.c +13 -18
  21. data/ext/nokogiri/xml_comment.c +19 -26
  22. data/ext/nokogiri/xml_document.c +230 -159
  23. data/ext/nokogiri/xml_document_fragment.c +13 -15
  24. data/ext/nokogiri/xml_dtd.c +54 -48
  25. data/ext/nokogiri/xml_element_content.c +30 -27
  26. data/ext/nokogiri/xml_element_decl.c +22 -22
  27. data/ext/nokogiri/xml_encoding_handler.c +17 -11
  28. data/ext/nokogiri/xml_entity_decl.c +32 -30
  29. data/ext/nokogiri/xml_entity_reference.c +16 -18
  30. data/ext/nokogiri/xml_namespace.c +56 -49
  31. data/ext/nokogiri/xml_node.c +354 -282
  32. data/ext/nokogiri/xml_node_set.c +168 -156
  33. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  34. data/ext/nokogiri/xml_reader.c +195 -172
  35. data/ext/nokogiri/xml_relax_ng.c +52 -28
  36. data/ext/nokogiri/xml_sax_parser.c +118 -118
  37. data/ext/nokogiri/xml_sax_parser_context.c +103 -86
  38. data/ext/nokogiri/xml_sax_push_parser.c +36 -27
  39. data/ext/nokogiri/xml_schema.c +111 -34
  40. data/ext/nokogiri/xml_syntax_error.c +42 -21
  41. data/ext/nokogiri/xml_text.c +13 -17
  42. data/ext/nokogiri/xml_xpath_context.c +206 -123
  43. data/ext/nokogiri/xslt_stylesheet.c +158 -165
  44. data/lib/nokogiri.rb +6 -27
  45. data/lib/nokogiri/css.rb +1 -0
  46. data/lib/nokogiri/css/node.rb +1 -0
  47. data/lib/nokogiri/css/parser.rb +63 -62
  48. data/lib/nokogiri/css/parser.y +2 -2
  49. data/lib/nokogiri/css/parser_extras.rb +39 -36
  50. data/lib/nokogiri/css/syntax_error.rb +1 -0
  51. data/lib/nokogiri/css/tokenizer.rb +1 -0
  52. data/lib/nokogiri/css/xpath_visitor.rb +73 -43
  53. data/lib/nokogiri/decorators/slop.rb +1 -0
  54. data/lib/nokogiri/extension.rb +26 -0
  55. data/lib/nokogiri/html.rb +1 -0
  56. data/lib/nokogiri/html/builder.rb +1 -0
  57. data/lib/nokogiri/html/document.rb +13 -26
  58. data/lib/nokogiri/html/document_fragment.rb +16 -15
  59. data/lib/nokogiri/html/element_description.rb +1 -0
  60. data/lib/nokogiri/html/element_description_defaults.rb +1 -0
  61. data/lib/nokogiri/html/entity_lookup.rb +1 -0
  62. data/lib/nokogiri/html/sax/parser.rb +1 -0
  63. data/lib/nokogiri/html/sax/parser_context.rb +1 -0
  64. data/lib/nokogiri/html/sax/push_parser.rb +1 -0
  65. data/lib/nokogiri/jruby/dependencies.rb +20 -0
  66. data/lib/nokogiri/syntax_error.rb +1 -0
  67. data/lib/nokogiri/version.rb +3 -109
  68. data/lib/nokogiri/version/constant.rb +5 -0
  69. data/lib/nokogiri/version/info.rb +205 -0
  70. data/lib/nokogiri/xml.rb +1 -0
  71. data/lib/nokogiri/xml/attr.rb +1 -0
  72. data/lib/nokogiri/xml/attribute_decl.rb +1 -0
  73. data/lib/nokogiri/xml/builder.rb +3 -2
  74. data/lib/nokogiri/xml/cdata.rb +1 -0
  75. data/lib/nokogiri/xml/character_data.rb +1 -0
  76. data/lib/nokogiri/xml/document.rb +49 -24
  77. data/lib/nokogiri/xml/document_fragment.rb +5 -6
  78. data/lib/nokogiri/xml/dtd.rb +1 -0
  79. data/lib/nokogiri/xml/element_content.rb +1 -0
  80. data/lib/nokogiri/xml/element_decl.rb +1 -0
  81. data/lib/nokogiri/xml/entity_decl.rb +1 -0
  82. data/lib/nokogiri/xml/entity_reference.rb +1 -0
  83. data/lib/nokogiri/xml/namespace.rb +1 -0
  84. data/lib/nokogiri/xml/node.rb +624 -290
  85. data/lib/nokogiri/xml/node/save_options.rb +1 -0
  86. data/lib/nokogiri/xml/node_set.rb +1 -0
  87. data/lib/nokogiri/xml/notation.rb +1 -0
  88. data/lib/nokogiri/xml/parse_options.rb +10 -3
  89. data/lib/nokogiri/xml/pp.rb +1 -0
  90. data/lib/nokogiri/xml/pp/character_data.rb +1 -0
  91. data/lib/nokogiri/xml/pp/node.rb +1 -0
  92. data/lib/nokogiri/xml/processing_instruction.rb +1 -0
  93. data/lib/nokogiri/xml/reader.rb +9 -12
  94. data/lib/nokogiri/xml/relax_ng.rb +7 -2
  95. data/lib/nokogiri/xml/sax.rb +1 -0
  96. data/lib/nokogiri/xml/sax/document.rb +1 -0
  97. data/lib/nokogiri/xml/sax/parser.rb +1 -0
  98. data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
  99. data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
  100. data/lib/nokogiri/xml/schema.rb +13 -4
  101. data/lib/nokogiri/xml/searchable.rb +25 -16
  102. data/lib/nokogiri/xml/syntax_error.rb +1 -0
  103. data/lib/nokogiri/xml/text.rb +1 -0
  104. data/lib/nokogiri/xml/xpath.rb +2 -3
  105. data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
  106. data/lib/nokogiri/xml/xpath_context.rb +1 -0
  107. data/lib/nokogiri/xslt.rb +1 -0
  108. data/lib/nokogiri/xslt/stylesheet.rb +1 -0
  109. data/lib/xsd/xmlparser/nokogiri.rb +1 -0
  110. data/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch +25 -0
  111. data/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +32 -0
  112. data/patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch +73 -0
  113. data/patches/libxml2/0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch +103 -0
  114. data/patches/libxml2/0008-use-glibc-strlen.patch +53 -0
  115. data/patches/libxml2/0009-avoid-isnan-isinf.patch +81 -0
  116. data/patches/libxml2/0010-parser.c-shrink-the-input-buffer-when-appropriate.patch +70 -0
  117. data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
  118. data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
  119. metadata +97 -154
  120. data/ext/nokogiri/html_document.h +0 -10
  121. data/ext/nokogiri/html_element_description.h +0 -10
  122. data/ext/nokogiri/html_entity_lookup.h +0 -8
  123. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  124. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  125. data/ext/nokogiri/xml_attr.h +0 -9
  126. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  127. data/ext/nokogiri/xml_cdata.h +0 -9
  128. data/ext/nokogiri/xml_comment.h +0 -9
  129. data/ext/nokogiri/xml_document.h +0 -23
  130. data/ext/nokogiri/xml_document_fragment.h +0 -10
  131. data/ext/nokogiri/xml_dtd.h +0 -10
  132. data/ext/nokogiri/xml_element_content.h +0 -10
  133. data/ext/nokogiri/xml_element_decl.h +0 -9
  134. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  135. data/ext/nokogiri/xml_entity_decl.h +0 -10
  136. data/ext/nokogiri/xml_entity_reference.h +0 -9
  137. data/ext/nokogiri/xml_io.c +0 -61
  138. data/ext/nokogiri/xml_io.h +0 -11
  139. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  140. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  141. data/ext/nokogiri/xml_namespace.h +0 -14
  142. data/ext/nokogiri/xml_node.h +0 -13
  143. data/ext/nokogiri/xml_node_set.h +0 -12
  144. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  145. data/ext/nokogiri/xml_reader.h +0 -10
  146. data/ext/nokogiri/xml_relax_ng.h +0 -9
  147. data/ext/nokogiri/xml_sax_parser.h +0 -39
  148. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  149. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  150. data/ext/nokogiri/xml_schema.h +0 -9
  151. data/ext/nokogiri/xml_syntax_error.h +0 -13
  152. data/ext/nokogiri/xml_text.h +0 -9
  153. data/ext/nokogiri/xml_xpath_context.h +0 -10
  154. data/ext/nokogiri/xslt_stylesheet.h +0 -14
  155. data/patches/libxslt/0001-Fix-security-framework-bypass.patch +0 -120
  156. data/ports/archives/libxml2-2.9.9.tar.gz +0 -0
  157. data/ports/archives/libxslt-1.1.33.tar.gz +0 -0
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class Node
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  ####
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class Notation < Struct.new(:name, :public_id, :system_id)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  ###
@@ -5,11 +6,11 @@ module Nokogiri
5
6
  #
6
7
  # == Building combinations of parse options
7
8
  # You can build your own combinations of these parse options by using any of the following methods:
8
- # *Note*: All examples attempt to set the +RECOVER+ & +NOENT+ options. All examples use Ruby 2 optional parameter syntax.
9
+ # *Note*: All examples attempt to set the +RECOVER+ & +NOENT+ options.
9
10
  # [Ruby's bitwise operators] You can use the Ruby bitwise operators to set various combinations.
10
- # Nokogiri.XML('<content>Chapter 1</content', options: Nokogiri::XML::ParseOptions.new((1 << 0) | (1 << 1)))
11
+ # Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new((1 << 0) | (1 << 1)))
11
12
  # [Method chaining] Every option has an equivalent method in lowercase. You can chain these methods together to set various combinations.
12
- # Nokogiri.XML('<content>Chapter 1</content', options: Nokogiri::XML::ParseOptions.new.recover.noent)
13
+ # Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new.recover.noent)
13
14
  # [Using Ruby Blocks] You can also setup parse combinations in the block passed to Nokogiri.XML or Nokogiri.HTML
14
15
  # Nokogiri.XML('<content>Chapter 1</content') {|config| config.recover.noent}
15
16
  #
@@ -72,6 +73,8 @@ module Nokogiri
72
73
  DEFAULT_XML = RECOVER | NONET
73
74
  # the default options used for parsing HTML documents
74
75
  DEFAULT_HTML = RECOVER | NOERROR | NOWARNING | NONET
76
+ # the default options used for parsing XML schemas
77
+ DEFAULT_SCHEMA = NONET
75
78
 
76
79
  attr_accessor :options
77
80
  def initialize options = STRICT
@@ -106,6 +109,10 @@ module Nokogiri
106
109
  @options & RECOVER == STRICT
107
110
  end
108
111
 
112
+ def ==(other)
113
+ other.to_i == to_i
114
+ end
115
+
109
116
  alias :to_i :options
110
117
 
111
118
  def inspect
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  require 'nokogiri/xml/pp/node'
2
3
  require 'nokogiri/xml/pp/character_data'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  module PP
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  module PP
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class ProcessingInstruction < Node
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  ###
@@ -85,19 +86,15 @@ module Nokogiri
85
86
  private :initialize
86
87
 
87
88
  ###
88
- # Get a list of attributes for the current node.
89
+ # Get the attributes of the current node as a Hash
90
+ # @return [Hash<String, String>] Attribute names and values
89
91
  def attributes
90
- Hash[attribute_nodes.map { |node|
91
- [node.name, node.to_s]
92
- }].merge(namespaces || {})
93
- end
94
-
95
- ###
96
- # Get a list of attributes for the current node
97
- def attribute_nodes
98
- nodes = attr_nodes
99
- nodes.each { |v| v.instance_variable_set(:@_r, self) }
100
- nodes
92
+ attrs_hash = attribute_nodes.each_with_object({}) do |node, hash|
93
+ hash[node.name] = node.to_s
94
+ end
95
+ ns = namespaces
96
+ attrs_hash.merge!(ns) if ns
97
+ attrs_hash
101
98
  end
102
99
 
103
100
  ###
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class << self
4
5
  ###
5
6
  # Create a new Nokogiri::XML::RelaxNG document from +string_or_io+.
6
7
  # See Nokogiri::XML::RelaxNG for an example.
7
- def RelaxNG string_or_io
8
- RelaxNG.new(string_or_io)
8
+ def RelaxNG(string_or_io, options = ParseOptions::DEFAULT_SCHEMA)
9
+ RelaxNG.new(string_or_io, options)
9
10
  end
10
11
  end
11
12
 
@@ -26,6 +27,10 @@ module Nokogiri
26
27
  # end
27
28
  #
28
29
  # The list of errors are Nokogiri::XML::SyntaxError objects.
30
+ #
31
+ # NOTE: RelaxNG input is always treated as TRUSTED documents, meaning that they will cause the
32
+ # underlying parsing libraries to access network resources. This is counter to Nokogiri's
33
+ # "untrusted by default" security policy, but is a limitation of the underlying libraries.
29
34
  class RelaxNG < Nokogiri::XML::Schema
30
35
  end
31
36
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'nokogiri/xml/sax/document'
2
3
  require 'nokogiri/xml/sax/parser_context'
3
4
  require 'nokogiri/xml/sax/parser'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  module SAX
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  module SAX
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  module SAX
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class << self
4
5
  ###
5
6
  # Create a new Nokogiri::XML::Schema object using a +string_or_io+
6
7
  # object.
7
- def Schema string_or_io
8
- Schema.new(string_or_io)
8
+ def Schema(string_or_io, options = ParseOptions::DEFAULT_SCHEMA)
9
+ Schema.new(string_or_io, options)
9
10
  end
10
11
  end
11
12
 
@@ -26,15 +27,23 @@ module Nokogiri
26
27
  # end
27
28
  #
28
29
  # The list of errors are Nokogiri::XML::SyntaxError objects.
30
+ #
31
+ # NOTE: As of v1.11.0, Schema treats inputs as UNTRUSTED by default, and so external entities
32
+ # are not resolved from the network (`http://` or `ftp://`). Previously, parsing treated
33
+ # documents as "trusted" by default which was counter to Nokogiri's "untrusted by default"
34
+ # security policy. If a document is trusted, then the caller may turn off the NONET option via
35
+ # the ParseOptions to re-enable external entity resolution over a network connection.
29
36
  class Schema
30
37
  # Errors while parsing the schema file
31
38
  attr_accessor :errors
39
+ # The Nokogiri::XML::ParseOptions used to parse the schema
40
+ attr_accessor :parse_options
32
41
 
33
42
  ###
34
43
  # Create a new Nokogiri::XML::Schema object using a +string_or_io+
35
44
  # object.
36
- def self.new string_or_io
37
- from_document Nokogiri::XML(string_or_io)
45
+ def self.new string_or_io, options = ParseOptions::DEFAULT_SCHEMA
46
+ from_document(Nokogiri::XML(string_or_io), options)
38
47
  end
39
48
 
40
49
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  #
@@ -11,7 +12,9 @@ module Nokogiri
11
12
  # Regular expression used by Searchable#search to determine if a query
12
13
  # string is CSS or XPath
13
14
  LOOKS_LIKE_XPATH = /^(\.\/|\/|\.\.|\.$)/
14
-
15
+
16
+ # @!group Searching via XPath or CSS Queries
17
+
15
18
  ###
16
19
  # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
17
20
  #
@@ -45,7 +48,7 @@ module Nokogiri
45
48
  # )
46
49
  #
47
50
  # See Searchable#xpath and Searchable#css for further usage help.
48
- def search *args
51
+ def search(*args)
49
52
  paths, handler, ns, binds = extract_params(args)
50
53
 
51
54
  xpaths = paths.map(&:to_s).map do |path|
@@ -54,6 +57,7 @@ module Nokogiri
54
57
 
55
58
  xpath(*(xpaths + [ns, handler, binds].compact))
56
59
  end
60
+
57
61
  alias :/ :search
58
62
 
59
63
  ###
@@ -63,9 +67,10 @@ module Nokogiri
63
67
  # result. +paths+ must be one or more XPath or CSS queries.
64
68
  #
65
69
  # See Searchable#search for more information.
66
- def at *args
70
+ def at(*args)
67
71
  search(*args).first
68
72
  end
73
+
69
74
  alias :% :at
70
75
 
71
76
  ###
@@ -101,7 +106,7 @@ module Nokogiri
101
106
  # found in an XML document, where tags names are case-sensitive
102
107
  # (e.g., "H1" is distinct from "h1").
103
108
  #
104
- def css *args
109
+ def css(*args)
105
110
  rules, handler, ns, _ = extract_params(args)
106
111
 
107
112
  css_internal self, rules, handler, ns
@@ -114,7 +119,7 @@ module Nokogiri
114
119
  # match. +rules+ must be one or more CSS selectors.
115
120
  #
116
121
  # See Searchable#css for more information.
117
- def at_css *args
122
+ def at_css(*args)
118
123
  css(*args).first
119
124
  end
120
125
 
@@ -148,7 +153,7 @@ module Nokogiri
148
153
  # end
149
154
  # }.new)
150
155
  #
151
- def xpath *args
156
+ def xpath(*args)
152
157
  paths, handler, ns, binds = extract_params(args)
153
158
 
154
159
  xpath_internal self, paths, handler, ns, binds
@@ -161,17 +166,19 @@ module Nokogiri
161
166
  # match. +paths+ must be one or more XPath queries.
162
167
  #
163
168
  # See Searchable#xpath for more information.
164
- def at_xpath *args
169
+ def at_xpath(*args)
165
170
  xpath(*args).first
166
171
  end
167
172
 
173
+ # @!endgroup
174
+
168
175
  private
169
176
 
170
- def css_internal node, rules, handler, ns
177
+ def css_internal(node, rules, handler, ns)
171
178
  xpath_internal node, css_rules_to_xpath(rules, ns), handler, ns, nil
172
179
  end
173
180
 
174
- def xpath_internal node, paths, handler, ns, binds
181
+ def xpath_internal(node, paths, handler, ns, binds)
175
182
  document = node.document
176
183
  return NodeSet.new(document) unless document
177
184
 
@@ -186,12 +193,12 @@ module Nokogiri
186
193
  end
187
194
  end
188
195
 
189
- def xpath_impl node, path, handler, ns, binds
196
+ def xpath_impl(node, path, handler, ns, binds)
190
197
  ctx = XPathContext.new(node)
191
198
  ctx.register_namespaces(ns)
192
- path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml?
199
+ path = path.gsub(/xmlns:/, " :") unless Nokogiri.uses_libxml?
193
200
 
194
- binds.each do |key,value|
201
+ binds.each do |key, value|
195
202
  ctx.register_variable key.to_s, value
196
203
  end if binds
197
204
 
@@ -202,13 +209,15 @@ module Nokogiri
202
209
  rules.map { |rule| xpath_query_from_css_rule(rule, ns) }
203
210
  end
204
211
 
205
- def xpath_query_from_css_rule rule, ns
212
+ def xpath_query_from_css_rule(rule, ns)
213
+ visitor = Nokogiri::CSS::XPathVisitorOptimallyUseBuiltins.new
206
214
  self.class::IMPLIED_XPATH_CONTEXTS.map do |implied_xpath_context|
207
- CSS.xpath_for(rule.to_s, :prefix => implied_xpath_context, :ns => ns)
208
- end.join(' | ')
215
+ CSS.xpath_for(rule.to_s, {:prefix => implied_xpath_context, :ns => ns,
216
+ :visitor => visitor})
217
+ end.join(" | ")
209
218
  end
210
219
 
211
- def extract_params params # :nodoc:
220
+ def extract_params(params) # :nodoc:
212
221
  handler = params.find do |param|
213
222
  ![Hash, String, Symbol].include?(param.class)
214
223
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class Text < Nokogiri::XML::CharacterData
@@ -1,10 +1,9 @@
1
+ # frozen_string_literal: true
1
2
  require 'nokogiri/xml/xpath/syntax_error'
2
3
 
3
4
  module Nokogiri
4
5
  module XML
5
- class XPath
6
- # The Nokogiri::XML::Document tied to this XPath instance
7
- attr_accessor :document
6
+ module XPath
8
7
  end
9
8
  end
10
9
  end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
- class XPath
4
+ module XPath
4
5
  class SyntaxError < XML::SyntaxError
5
6
  def to_s
6
7
  [super.chomp, str1].compact.join(': ')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XML
3
4
  class XPathContext
data/lib/nokogiri/xslt.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'nokogiri/xslt/stylesheet'
2
3
 
3
4
  module Nokogiri
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Nokogiri
2
3
  module XSLT
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'nokogiri'
2
3
 
3
4
  module XSD # :nodoc:
@@ -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
+