rexml 3.3.7 → 3.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a402bb00d8bf352521fb6ca5354ba92a22d110feedcba40a50e2de5abad277a
4
- data.tar.gz: 51f7b5893eef8d8183eb14c719064368029b18c9909b3454047e308c7425ce5b
3
+ metadata.gz: 9d8de4465de1e9548d66ad026772932f724b9747dc8b1c62960d8efeaeaa8412
4
+ data.tar.gz: 1cb29aaa36dcef98ba8bd4e9fa249959405f67fdb6bed54d12b466fdf43f57af
5
5
  SHA512:
6
- metadata.gz: ff091fe421748562931d65301e66dc1d4d313e1c28cce753bc9f31a1f9bac65c0b4939db70117e47f2c3158daa24b708e2519a98a9638114f4e5a1c0d1265e7c
7
- data.tar.gz: 720bc72a86eacebbe9a990152d4d0dfcde2e50c71b3fbabaaba44dec91b2f6ff7ca6180b86622cf0ffb36355ab5e5d43f8948e67c70ab4fca1f8bf0882a3585d
6
+ metadata.gz: 78c881a10f12e46e1b6710d6ec75e42e4311c233376a7587756bc098063d21f52a4d82bcac8201001bf7e39079b3db4015482dae5b4ba46e561ef75fa15b15a0
7
+ data.tar.gz: 8d7a4b94937ce7b0bdf6ed83152fe207098dfe45333498a64e50d5fe9a686dffa2f66913c1edf265470b2b6a04cfae20857f1cffa404c278249784eeb533d594
data/NEWS.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # News
2
2
 
3
+ ## 3.3.9 - 2024-10-24 {#version-3-3-9}
4
+
5
+ ### Improvements
6
+
7
+ * Improved performance.
8
+ * GH-210
9
+ * Patch by NAITOH Jun.
10
+
11
+ ### Fixes
12
+
13
+ * Fixed a parse bug for text only invalid XML.
14
+ * GH-215
15
+ * Patch by NAITOH Jun.
16
+
17
+ * Fixed a parse bug that `&#0x...;` is accepted as a character
18
+ reference.
19
+
20
+ ### Thanks
21
+
22
+ * NAITOH Jun
23
+
24
+ ## 3.3.8 - 2024-09-29 {#version-3-3-8}
25
+
26
+ ### Improvements
27
+
28
+ * SAX2: Improve parse performance.
29
+ * GH-207
30
+ * Patch by NAITOH Jun.
31
+
32
+ ### Fixes
33
+
34
+ * Fixed a bug that unexpected attribute namespace conflict error for
35
+ the predefined "xml" namespace is reported.
36
+ * GH-208
37
+ * Patch by KITAITI Makoto
38
+
39
+ ### Thanks
40
+
41
+ * NAITOH Jun
42
+
43
+ * KITAITI Makoto
44
+
3
45
  ## 3.3.7 - 2024-09-04 {#version-3-3-7}
4
46
 
5
47
  ### Improvements
@@ -150,12 +150,13 @@ module REXML
150
150
  PEDECL_PATTERN = "\\s+(%)\\s+#{NAME}\\s+#{PEDEF}\\s*>"
151
151
  ENTITYDECL_PATTERN = /(?:#{GEDECL_PATTERN})|(?:#{PEDECL_PATTERN})/um
152
152
  CARRIAGE_RETURN_NEWLINE_PATTERN = /\r\n?/
153
- CHARACTER_REFERENCES = /&#0*((?:\d+)|(?:x[a-fA-F0-9]+));/
153
+ CHARACTER_REFERENCES = /&#((?:\d+)|(?:x[a-fA-F0-9]+));/
154
154
  DEFAULT_ENTITIES_PATTERNS = {}
155
155
  default_entities = ['gt', 'lt', 'quot', 'apos', 'amp']
156
156
  default_entities.each do |term|
157
157
  DEFAULT_ENTITIES_PATTERNS[term] = /&#{term};/
158
158
  end
159
+ XML_PREFIXED_NAMESPACE = "http://www.w3.org/XML/1998/namespace"
159
160
  end
160
161
  private_constant :Private
161
162
 
@@ -166,6 +167,7 @@ module REXML
166
167
  @entity_expansion_count = 0
167
168
  @entity_expansion_limit = Security.entity_expansion_limit
168
169
  @entity_expansion_text_limit = Security.entity_expansion_text_limit
170
+ @source.ensure_buffer
169
171
  end
170
172
 
171
173
  def add_listener( listener )
@@ -185,7 +187,7 @@ module REXML
185
187
  @tags = []
186
188
  @stack = []
187
189
  @entities = []
188
- @namespaces = {}
190
+ @namespaces = {"xml" => Private::XML_PREFIXED_NAMESPACE}
189
191
  @namespaces_restore_stack = []
190
192
  end
191
193
 
@@ -568,8 +570,12 @@ module REXML
568
570
  return rv if matches.size == 0
569
571
  rv.gsub!( Private::CHARACTER_REFERENCES ) {
570
572
  m=$1
571
- m = "0#{m}" if m[0] == ?x
572
- [Integer(m)].pack('U*')
573
+ if m.start_with?("x")
574
+ code_point = Integer(m[1..-1], 16)
575
+ else
576
+ code_point = Integer(m, 10)
577
+ end
578
+ [code_point].pack('U*')
573
579
  }
574
580
  matches.collect!{|x|x[0]}.compact!
575
581
  if filter
@@ -790,7 +796,7 @@ module REXML
790
796
  @source.match(/\s*/um, true)
791
797
  if prefix == "xmlns"
792
798
  if local_part == "xml"
793
- if value != "http://www.w3.org/XML/1998/namespace"
799
+ if value != Private::XML_PREFIXED_NAMESPACE
794
800
  msg = "The 'xml' prefix must not be bound to any other namespace "+
795
801
  "(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
796
802
  raise REXML::ParseException.new( msg, @source, self )
@@ -259,6 +259,8 @@ module REXML
259
259
  end
260
260
 
261
261
  def get_namespace( prefix )
262
+ return nil if @namespace_stack.empty?
263
+
262
264
  uris = (@namespace_stack.find_all { |ns| not ns[prefix].nil? }) ||
263
265
  (@namespace_stack.find { |ns| not ns[nil].nil? })
264
266
  uris[-1][prefix] unless uris.nil? or 0 == uris.size
data/lib/rexml/rexml.rb CHANGED
@@ -31,7 +31,7 @@
31
31
  module REXML
32
32
  COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>"
33
33
  DATE = "2008/019"
34
- VERSION = "3.3.7"
34
+ VERSION = "3.3.9"
35
35
  REVISION = ""
36
36
 
37
37
  Copyright = COPYRIGHT
data/lib/rexml/source.rb CHANGED
@@ -77,6 +77,7 @@ module REXML
77
77
  detect_encoding
78
78
  end
79
79
  @line = 0
80
+ @term_encord = {}
80
81
  end
81
82
 
82
83
  # The current buffer (what we're going to read next)
@@ -227,7 +228,7 @@ module REXML
227
228
 
228
229
  def read_until(term)
229
230
  pattern = Private::PRE_DEFINED_TERM_PATTERNS[term] || /#{Regexp.escape(term)}/
230
- term = encode(term)
231
+ term = @term_encord[term] ||= encode(term)
231
232
  until str = @scanner.scan_until(pattern)
232
233
  break if @source.nil?
233
234
  break if @source.eof?
@@ -294,14 +295,19 @@ module REXML
294
295
 
295
296
  private
296
297
  def readline(term = nil)
297
- str = @source.readline(term || @line_break)
298
298
  if @pending_buffer
299
+ begin
300
+ str = @source.readline(term || @line_break)
301
+ rescue IOError
302
+ end
299
303
  if str.nil?
300
304
  str = @pending_buffer
301
305
  else
302
306
  str = @pending_buffer + str
303
307
  end
304
308
  @pending_buffer = nil
309
+ else
310
+ str = @source.readline(term || @line_break)
305
311
  end
306
312
  return nil if str.nil?
307
313
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexml
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.7
4
+ version: 3.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-09-04 00:00:00.000000000 Z
10
+ date: 2024-10-24 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: An XML toolkit for Ruby
13
13
  email:
@@ -102,7 +102,7 @@ homepage: https://github.com/ruby/rexml
102
102
  licenses:
103
103
  - BSD-2-Clause
104
104
  metadata:
105
- changelog_uri: https://github.com/ruby/rexml/releases/tag/v3.3.7
105
+ changelog_uri: https://github.com/ruby/rexml/releases/tag/v3.3.9
106
106
  rdoc_options:
107
107
  - "--main"
108
108
  - README.md