i8c-stream-2.5
changed/i8c-stream-2.5/ruby-2.5.9-113.module+el8.10.0+22581+23fc9c9e
parent
f2073d2a17
commit
44d4f263b3
@ -0,0 +1,31 @@
|
||||
From ce59f2eb1aeb371fe1643414f06618dbe031979f Mon Sep 17 00:00:00 2001
|
||||
From: Sutou Kouhei <kou@clear-code.com>
|
||||
Date: Thu, 24 Oct 2024 14:45:31 +0900
|
||||
Subject: [PATCH] parser: fix a bug that �x...; is accepted as a character
|
||||
reference
|
||||
|
||||
---
|
||||
lib/rexml/parsers/baseparser.rb | 10 +++++++---
|
||||
test/parse/test_character_reference.rb | 6 ++++++
|
||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
|
||||
index 7bd8adf..b4547ba 100644
|
||||
--- a/lib/rexml/parsers/baseparser.rb
|
||||
+++ b/lib/rexml/parsers/baseparser.rb
|
||||
@@ -492,8 +492,12 @@ def unnormalize( string, entities=nil, filter=nil )
|
||||
return rv if matches.size == 0
|
||||
- rv.gsub!( /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ ) {
|
||||
+ rv.gsub!( /&#((?:\d+)|(?:x[a-fA-F0-9]+));/ ) {
|
||||
m=$1
|
||||
- m = "0#{m}" if m[0] == ?x
|
||||
- [Integer(m)].pack('U*')
|
||||
+ if m.start_with?("x")
|
||||
+ code_point = Integer(m[1..-1], 16)
|
||||
+ else
|
||||
+ code_point = Integer(m, 10)
|
||||
+ end
|
||||
+ [code_point].pack('U*')
|
||||
}
|
||||
matches.collect!{|x|x[0]}.compact!
|
||||
if matches.size > 0
|
Loading…
Reference in new issue