mirror of
https://git.yoctoproject.org/poky
synced 2026-04-13 23:02:30 +02:00
REXML is an XML toolkit for Ruby. The REXML gem before 3.3.9 has a ReDoS vulnerability when it parses an XML that has many digits between &# and x...; in a hex numeric character reference (&#x.... This does not happen with Ruby 3.2 or later. Ruby 3.1 is the only affected maintained Ruby. The REXML gem 3.3.9 or later include the patch to fix the vulnerability. CVE-2024-49761-0009.patch is the CVE fix and rest are dependent commits. Reference: https://nvd.nist.gov/vuln/detail/CVE-2024-49761 Upstream-patch:810d22852383ca5c4b0f51217dbcc67e4049f6a6fc6cad570b7712855547370666e314a579730f25ce59f2eb1a(From OE-Core rev: 5b453400e9dd878b81b1447d14b3f518809de17e) Signed-off-by: Divya Chellam <divya.chellam@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
From fc6cad570b849692a28f26a963ceb58edc282bbc Mon Sep 17 00:00:00 2001
|
|
From: NAITOH Jun <naitoh@gmail.com>
|
|
Date: Fri, 16 Feb 2024 04:51:16 +0900
|
|
Subject: [PATCH] Remove unnecessary checks in baseparser (#112)
|
|
|
|
https://github.com/ruby/rexml/blob/444c9ce7449d3c5a75ae50087555ec73ae1963a8/lib/rexml/parsers/baseparser.rb#L352-L425
|
|
```
|
|
next_data = @source.buffer
|
|
if next_data.size < 2
|
|
@source.read
|
|
next_data = @source.buffer
|
|
end
|
|
if next_data[0] == ?<
|
|
:
|
|
(omit)
|
|
:
|
|
else # next_data is a string of one or more characters other than '<'.
|
|
md = @source.match( TEXT_PATTERN, true ) # TEXT_PATTERN = /\A([^<]*)/um
|
|
text = md[1]
|
|
if md[0].length == 0 # md[0].length is greater than or equal to 1.
|
|
@source.match( /(\s+)/, true )
|
|
end
|
|
```
|
|
This is an unnecessary check because md[0].length is greater than or
|
|
equal to 1.
|
|
|
|
CVE: CVE-2024-49761
|
|
|
|
Upstream-Status: Backport [https://github.com/ruby/rexml/commit/fc6cad570b849692a28f26a963ceb58edc282bbc]
|
|
|
|
Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
|
|
---
|
|
.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb | 3 ---
|
|
1 file changed, 3 deletions(-)
|
|
|
|
diff --git a/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb b/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb
|
|
index 3fe5c29..595669c 100644
|
|
--- a/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb
|
|
+++ b/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb
|
|
@@ -420,9 +420,6 @@ module REXML
|
|
else
|
|
md = @source.match( TEXT_PATTERN, true )
|
|
text = md[1]
|
|
- if md[0].length == 0
|
|
- @source.match( /(\s+)/, true )
|
|
- end
|
|
return [ :text, text ]
|
|
end
|
|
rescue REXML::UndefinedNamespaceException
|
|
--
|
|
2.40.0
|