diff options
| -rw-r--r-- | meta/recipes-devtools/ruby/ruby/CVE-2024-43398.patch | 81 | ||||
| -rw-r--r-- | meta/recipes-devtools/ruby/ruby_3.1.3.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-devtools/ruby/ruby/CVE-2024-43398.patch b/meta/recipes-devtools/ruby/ruby/CVE-2024-43398.patch new file mode 100644 index 0000000000..02dc0a20be --- /dev/null +++ b/meta/recipes-devtools/ruby/ruby/CVE-2024-43398.patch | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | From 7cb5eaeb221c322b9912f724183294d8ce96bae3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sutou Kouhei <kou@clear-code.com> | ||
| 3 | Date: Sat, 17 Aug 2024 17:45:52 +0900 | ||
| 4 | Subject: [PATCH] parser tree: improve namespace conflicted attribute check | ||
| 5 | performance | ||
| 6 | |||
| 7 | It was slow for deep element. | ||
| 8 | |||
| 9 | Reported by l33thaxor. Thanks!!! | ||
| 10 | |||
| 11 | The changes to the test folder files are not included in this patch | ||
| 12 | because the test folder was not generated during the devtool source build. | ||
| 13 | |||
| 14 | CVE: CVE-2024-43398 | ||
| 15 | |||
| 16 | Upstream-Status: Backport [https://github.com/ruby/rexml/commit/7cb5eaeb221c322b9912f724183294d8ce96bae3] | ||
| 17 | |||
| 18 | Signed-off-by: Divya Chellam <divya.chellam@windriver.com> | ||
| 19 | --- | ||
| 20 | .bundle/gems/rexml-3.2.5/lib/rexml/element.rb | 11 ----------- | ||
| 21 | .../rexml-3.2.5/lib/rexml/parsers/baseparser.rb | 15 +++++++++++++++ | ||
| 22 | 2 files changed, 15 insertions(+), 11 deletions(-) | ||
| 23 | |||
| 24 | diff --git a/.bundle/gems/rexml-3.2.5/lib/rexml/element.rb b/.bundle/gems/rexml-3.2.5/lib/rexml/element.rb | ||
| 25 | index 4c21dbd..78e78c2 100644 | ||
| 26 | --- a/.bundle/gems/rexml-3.2.5/lib/rexml/element.rb | ||
| 27 | +++ b/.bundle/gems/rexml-3.2.5/lib/rexml/element.rb | ||
| 28 | @@ -2388,17 +2388,6 @@ module REXML | ||
| 29 | elsif old_attr.kind_of? Hash | ||
| 30 | old_attr[value.prefix] = value | ||
| 31 | elsif old_attr.prefix != value.prefix | ||
| 32 | - # Check for conflicting namespaces | ||
| 33 | - if value.prefix != "xmlns" and old_attr.prefix != "xmlns" | ||
| 34 | - old_namespace = old_attr.namespace | ||
| 35 | - new_namespace = value.namespace | ||
| 36 | - if old_namespace == new_namespace | ||
| 37 | - raise ParseException.new( | ||
| 38 | - "Namespace conflict in adding attribute \"#{value.name}\": "+ | ||
| 39 | - "Prefix \"#{old_attr.prefix}\" = \"#{old_namespace}\" and "+ | ||
| 40 | - "prefix \"#{value.prefix}\" = \"#{new_namespace}\"") | ||
| 41 | - end | ||
| 42 | - end | ||
| 43 | store value.name, {old_attr.prefix => old_attr, | ||
| 44 | value.prefix => value} | ||
| 45 | else | ||
| 46 | 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 | ||
| 47 | index e32c7f4..154f2ac 100644 | ||
| 48 | --- a/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb | ||
| 49 | +++ b/.bundle/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb | ||
| 50 | @@ -634,6 +634,7 @@ module REXML | ||
| 51 | |||
| 52 | def parse_attributes(prefixes, curr_ns) | ||
| 53 | attributes = {} | ||
| 54 | + expanded_names = {} | ||
| 55 | closed = false | ||
| 56 | match_data = @source.match(/^(.*?)(\/)?>/um, true) | ||
| 57 | if match_data.nil? | ||
| 58 | @@ -641,6 +642,20 @@ module REXML | ||
| 59 | raise REXML::ParseException.new(message, @source) | ||
| 60 | end | ||
| 61 | |||
| 62 | + unless prefix == "xmlns" | ||
| 63 | + uri = @namespaces[prefix] | ||
| 64 | + expanded_name = [uri, local_part] | ||
| 65 | + existing_prefix = expanded_names[expanded_name] | ||
| 66 | + if existing_prefix | ||
| 67 | + message = "Namespace conflict in adding attribute " + | ||
| 68 | + "\"#{local_part}\": " + | ||
| 69 | + "Prefix \"#{existing_prefix}\" = \"#{uri}\" and " + | ||
| 70 | + "prefix \"#{prefix}\" = \"#{uri}\"" | ||
| 71 | + raise REXML::ParseException.new(message, @source, self) | ||
| 72 | + end | ||
| 73 | + expanded_names[expanded_name] = prefix | ||
| 74 | + end | ||
| 75 | + | ||
| 76 | raw_attributes = match_data[1] | ||
| 77 | closed = !match_data[2].nil? | ||
| 78 | return attributes, closed if raw_attributes.nil? | ||
| 79 | -- | ||
| 80 | 2.40.0 | ||
| 81 | |||
diff --git a/meta/recipes-devtools/ruby/ruby_3.1.3.bb b/meta/recipes-devtools/ruby/ruby_3.1.3.bb index 76e5ac81ed..ca061e7f70 100644 --- a/meta/recipes-devtools/ruby/ruby_3.1.3.bb +++ b/meta/recipes-devtools/ruby/ruby_3.1.3.bb | |||
| @@ -48,6 +48,7 @@ SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \ | |||
| 48 | file://CVE-2024-41946.patch \ | 48 | file://CVE-2024-41946.patch \ |
| 49 | file://CVE-2025-27220.patch \ | 49 | file://CVE-2025-27220.patch \ |
| 50 | file://CVE-2025-27219.patch \ | 50 | file://CVE-2025-27219.patch \ |
| 51 | file://CVE-2024-43398.patch \ | ||
| 51 | " | 52 | " |
| 52 | UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" | 53 | UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" |
| 53 | 54 | ||
