diff options
Diffstat (limited to 'poky/meta/recipes-devtools/ruby')
16 files changed, 305 insertions, 327 deletions
diff --git a/poky/meta/recipes-devtools/ruby/ruby/0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch b/poky/meta/recipes-devtools/ruby/ruby/0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch deleted file mode 100644 index 1dff9c0f8c..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 6b3c202b46b9312c5bb0789145f13d8086e70948 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 15 Jan 2023 02:34:17 -0800 -Subject: [PATCH] fiddle: Use C11 _Alignof to define ALIGN_OF when possible - -WG14 N2350 made very clear that it is an UB having type definitions -within "offsetof" [1]. This patch enhances the implementation of macro -ALIGN_OF to use builtin "_Alignof" to avoid undefined behavior -when using std=c11 or newer - -clang 16+ has started to flag this [2] - -Fixes build when using -std >= gnu11 and using clang16+ - -Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it -may support C11, exclude those compiler versions - -[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm -[2] https://reviews.llvm.org/D133574 - -Upstream-Status: Submitted [https://github.com/ruby/fiddle/pull/120] -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - ext/fiddle/fiddle.h | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h -index 10eb9ce..ffb395e 100644 ---- a/ext/fiddle/fiddle.h -+++ b/ext/fiddle/fiddle.h -@@ -196,7 +196,17 @@ - #endif - #define TYPE_UINTPTR_T (-TYPE_INTPTR_T) - --#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x) -+/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 -+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. -+ clang versions < 8.0.0 have the same bug. */ -+#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ -+ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ -+ && !defined __clang__) \ -+ || (defined __clang__ && __clang_major__ < 8)) -+# define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x) -+#else -+# define ALIGN_OF(type) _Alignof(type) -+#endif - - #define ALIGN_VOIDP ALIGN_OF(void*) - #define ALIGN_CHAR ALIGN_OF(char) --- -2.39.0 - diff --git a/poky/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch b/poky/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch deleted file mode 100644 index 226ef3af75..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 2368d07660a93a2c41d63f3ab6054ca4daeef820 Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin <alex.kanavin@gmail.com> -Date: Tue, 17 Nov 2020 18:31:40 +0000 -Subject: [PATCH] template/Makefile.in: do not write host cross-cc items into - target config - -This helps reproducibility. - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> ---- - template/Makefile.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/template/Makefile.in b/template/Makefile.in -index 10dc826..940ee07 100644 ---- a/template/Makefile.in -+++ b/template/Makefile.in -@@ -657,11 +657,11 @@ mjit_config.h: - echo '#endif'; \ - quote MJIT_MIN_HEADER_NAME "$(MJIT_MIN_HEADER_NAME)"; \ - sep=,; \ -- quote "MJIT_CC_COMMON " $(MJIT_CC); \ -+ quote "MJIT_CC_COMMON " ; \ - quote "MJIT_CFLAGS MJIT_ARCHFLAG" $(MJIT_CFLAGS); \ - quote "MJIT_OPTFLAGS " $(MJIT_OPTFLAGS); \ - quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \ -- quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \ -+ quote "MJIT_LDSHARED " ; \ - quote "MJIT_DLDFLAGS MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \ - quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \ - quote 'PRELOADENV "@PRELOADENV@"'; \ diff --git a/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch b/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch deleted file mode 100644 index 96ae86263b..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 21d8e7700fa0a9c4bf569dd366134060ae858832 Mon Sep 17 00:00:00 2001 -From: Christopher Larson <chris_larson@mentor.com> -Date: Thu, 5 May 2016 10:59:07 -0700 -Subject: [PATCH] Obey LDFLAGS for the link of libruby - -Signed-off-by: Christopher Larson <chris_larson@mentor.com> -Upstream-Status: Pending - ---- - template/Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/template/Makefile.in b/template/Makefile.in -index 1456313..15b98a4 100644 ---- a/template/Makefile.in -+++ b/template/Makefile.in -@@ -127,7 +127,7 @@ ENABLE_SHARED = @ENABLE_SHARED@ - LDSHARED = @LIBRUBY_LDSHARED@ - DLDSHARED = @DLDSHARED@ - XDLDFLAGS = @DLDFLAGS@ --DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(XLDFLAGS) $(ARCH_FLAG) -+DLDFLAGS = @LIBRUBY_DLDFLAGS@ @LDFLAGS@ $(XLDFLAGS) $(ARCH_FLAG) - SOLIBS = @SOLIBS@ - ENABLE_DEBUG_ENV = @ENABLE_DEBUG_ENV@ - MAINLIBS = $(YJIT_LIBS) @MAINLIBS@ diff --git a/poky/meta/recipes-devtools/ruby/ruby/0002-template-Makefile.in-filter-out-f-prefix-map.patch b/poky/meta/recipes-devtools/ruby/ruby/0002-template-Makefile.in-filter-out-f-prefix-map.patch deleted file mode 100644 index 2efbad7513..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/0002-template-Makefile.in-filter-out-f-prefix-map.patch +++ /dev/null @@ -1,42 +0,0 @@ -Subject: [PATCH] template/Makefile.in: filter out -f*prefix-map - -If we add DEBUG_PREFIX_MAP into LDFLAGS, ruby and ruby-dbg are no longer -reproducible. Fix this. - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Tony Battersby <tonyb@cybernetics.com> ---- ---- a/tool/mjit_archflag.sh -+++ b/tool/mjit_archflag.sh -@@ -7,6 +7,20 @@ quote() { - echo - } - -+quote_filtered() { -+ printf "#${indent}define $1" -+ while shift && [ "$#" -gt 0 ]; do -+ case "$1" in -+ -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*) -+ ;; -+ *) -+ printf ' "%s"'$sep "$1" -+ ;; -+ esac -+ done -+ echo -+} -+ - archs="" - arch_flag="" - ---- a/template/Makefile.in -+++ b/template/Makefile.in -@@ -666,7 +666,7 @@ mjit_config.h: - quote "MJIT_OPTFLAGS " $(MJIT_OPTFLAGS); \ - quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \ - quote "MJIT_LDSHARED " ; \ -- quote "MJIT_DLDFLAGS MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \ -+ quote_filtered "MJIT_DLDFLAGS MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \ - quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \ - quote 'PRELOADENV "@PRELOADENV@"'; \ - indent=$${archs:+' '}; \ diff --git a/poky/meta/recipes-devtools/ruby/ruby/0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch b/poky/meta/recipes-devtools/ruby/ruby/0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch index 41f206523e..0902a201ec 100644 --- a/poky/meta/recipes-devtools/ruby/ruby/0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch +++ b/poky/meta/recipes-devtools/ruby/ruby/0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch @@ -12,20 +12,20 @@ Upstream-Status: Backport [debian] 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb -index 0d72cee..eb7bc25 100644 +index d6eac7f..4b2e95e 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb -@@ -1691,7 +1691,9 @@ class Gem::Specification < Gem::BasicSpecification - raise(Gem::InvalidSpecificationException, - "invalid date format in specification: #{date.inspect}") - end -- when Time, DateLike then -+ when Time then -+ Time.utc(date.utc.year, date.utc.month, date.utc.day) -+ when DateLike then - Time.utc(date.year, date.month, date.day) - else - TODAY +@@ -1707,7 +1707,9 @@ class Gem::Specification < Gem::BasicSpecification + raise(Gem::InvalidSpecificationException, + "invalid date format in specification: #{date.inspect}") + end +- when Time, DateLike then ++ when Time then ++ Time.utc(date.utc.year, date.utc.month, date.utc.day) ++ when DateLike then + Time.utc(date.year, date.month, date.day) + else + TODAY -- -2.25.1 +2.40.0 diff --git a/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch b/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch index 0a87cae17f..d32e209129 100644 --- a/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch +++ b/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch @@ -7,7 +7,6 @@ Without an explicit date, they will get the current date and make the build unreproducible Upstream-Status: Backport [debian] - --- ext/bigdecimal/bigdecimal.gemspec | 1 + ext/fiddle/fiddle.gemspec | 1 + @@ -17,12 +16,12 @@ Upstream-Status: Backport [debian] 5 files changed, 5 insertions(+) diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec -index d215757..5148d56 100644 +index f9f3b45..b9a469d 100644 --- a/ext/bigdecimal/bigdecimal.gemspec +++ b/ext/bigdecimal/bigdecimal.gemspec -@@ -4,6 +4,7 @@ Gem::Specification.new do |s| - s.name = "bigdecimal" - s.version = "3.1.3" +@@ -14,6 +14,7 @@ Gem::Specification.new do |s| + s.name = name + s.version = source_version s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"] + s.date = RUBY_RELEASE_DATE s.email = ["mrkn@mrkn.jp"] @@ -41,10 +40,10 @@ index 8781093..efdca32 100644 spec.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org"] diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec -index d26a757..cc88c55 100644 +index d4f5276..8f89611 100644 --- a/ext/io/console/io-console.gemspec +++ b/ext/io/console/io-console.gemspec -@@ -4,6 +4,7 @@ _VERSION = "0.6.0" +@@ -4,6 +4,7 @@ _VERSION = "0.7.1" Gem::Specification.new do |s| s.name = "io-console" s.version = _VERSION @@ -65,7 +64,7 @@ index 1f4798e..48743cf 100644 spec.email = ["knu@idaemons.org", "ume@mahoroba.org"] diff --git a/lib/rdoc/rdoc.gemspec b/lib/rdoc/rdoc.gemspec -index 3c96f7d..fec0872 100644 +index 93a281c..cc5c155 100644 --- a/lib/rdoc/rdoc.gemspec +++ b/lib/rdoc/rdoc.gemspec @@ -7,6 +7,7 @@ end @@ -76,3 +75,6 @@ index 3c96f7d..fec0872 100644 s.version = RDoc::VERSION s.authors = [ +-- +2.40.0 + diff --git a/poky/meta/recipes-devtools/ruby/ruby/0007-Skip-test_rm_r_no_permissions-test-under-root.patch b/poky/meta/recipes-devtools/ruby/ruby/0007-Skip-test_rm_r_no_permissions-test-under-root.patch new file mode 100644 index 0000000000..dc06891bbc --- /dev/null +++ b/poky/meta/recipes-devtools/ruby/ruby/0007-Skip-test_rm_r_no_permissions-test-under-root.patch @@ -0,0 +1,30 @@ +From cc5e563f0fa5212e4a624b954fbc97cc6d8900d4 Mon Sep 17 00:00:00 2001 +From: Jiaying Song <jiaying.song.cn@windriver.com> +Date: Mon, 25 Aug 2025 16:31:18 +0800 +Subject: [PATCH] Skip test_rm_r_no_permissions test under root + +Skip the test_rm_r_no_permissions test under the root user, as deletion always succeeds. + +Upstream-Status: Submitted [https://github.com/ruby/fileutils/pull/133/commits/3c831389c5e1523af5869d025f573ff043486b99] + +Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com> +--- + test/fileutils/test_fileutils.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb +index 481f913..a2ed414 100644 +--- a/test/fileutils/test_fileutils.rb ++++ b/test/fileutils/test_fileutils.rb +@@ -757,7 +757,7 @@ class TestFileUtils < Test::Unit::TestCase + def test_rm_r_no_permissions + check_singleton :rm_rf + +- return if /mswin|mingw/ =~ RUBY_PLATFORM ++ return if /mswin|mingw/ =~ RUBY_PLATFORM || root_in_posix? + + mkdir 'tmpdatadir' + touch 'tmpdatadir/tmpdata' +-- +2.34.1 + diff --git a/poky/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch b/poky/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch deleted file mode 100644 index 17c7e30176..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_1.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 2ebb50d2dc302917a6f57c1239dc9e700dfe0e34 Mon Sep 17 00:00:00 2001 -From: Nobuyoshi Nakada <nobu@ruby-lang.org> -Date: Thu, 27 Jul 2023 15:53:01 +0800 -Subject: [PATCH] Fix quadratic backtracking on invalid relative URI - -https://hackerone.com/reports/1958260 - -CVE: CVE-2023-36617 - -Upstream-Status: Backport [https://github.com/ruby/uri/commit/9010ee2536adda10a0555ae1ed6fe2f5808e6bf1] - -Signed-off-by: Mingli Yu <mingli.yu@windriver.com> ---- - lib/uri/rfc2396_parser.rb | 4 ++-- - test/uri/test_parser.rb | 12 ++++++++++++ - 2 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb -index 76a8f99..00c66cf 100644 ---- a/lib/uri/rfc2396_parser.rb -+++ b/lib/uri/rfc2396_parser.rb -@@ -497,8 +497,8 @@ module URI - ret = {} - - # for URI::split -- ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED) -- ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED) -+ ret[:ABS_URI] = Regexp.new('\A\s*+' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED) -+ ret[:REL_URI] = Regexp.new('\A\s*+' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED) - - # for URI::extract - ret[:URI_REF] = Regexp.new(pattern[:URI_REF]) -diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb -index 72fb590..721e05e 100644 ---- a/test/uri/test_parser.rb -+++ b/test/uri/test_parser.rb -@@ -79,4 +79,16 @@ class URI::TestParser < Test::Unit::TestCase - assert_equal([nil, nil, "example.com", nil, nil, "", nil, nil, nil], URI.split("//example.com")) - assert_equal([nil, nil, "[0::0]", nil, nil, "", nil, nil, nil], URI.split("//[0::0]")) - end -+ -+ def test_rfc2822_parse_relative_uri -+ pre = ->(length) { -+ " " * length + "\0" -+ } -+ parser = URI::RFC2396_Parser.new -+ assert_linear_performance((1..5).map {|i| 10**i}, pre: pre) do |uri| -+ assert_raise(URI::InvalidURIError) do -+ parser.split(uri) -+ end -+ end -+ end - end --- -2.25.1 - diff --git a/poky/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch b/poky/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch deleted file mode 100644 index 7c51deaa42..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/CVE-2023-36617_2.patch +++ /dev/null @@ -1,52 +0,0 @@ -From eea5868120509c245216c4b5c2d4b5db1c593d0e Mon Sep 17 00:00:00 2001 -From: Nobuyoshi Nakada <nobu@ruby-lang.org> -Date: Thu, 27 Jul 2023 16:16:30 +0800 -Subject: [PATCH] Fix quadratic backtracking on invalid port number - -https://hackerone.com/reports/1958260 - -CVE: CVE-2023-36617 - -Upstream-Status: Backport [https://github.com/ruby/uri/commit/9d7bcef1e6ad23c9c6e4932f297fb737888144c8] - -Signed-off-by: Mingli Yu <mingli.yu@windriver.com> ---- - lib/uri/rfc3986_parser.rb | 2 +- - test/uri/test_parser.rb | 10 ++++++++++ - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb -index dd24a40..9b1663d 100644 ---- a/lib/uri/rfc3986_parser.rb -+++ b/lib/uri/rfc3986_parser.rb -@@ -100,7 +100,7 @@ module URI - QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/, - FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/, - OPAQUE: /\A(?:[^\/].*)?\z/, -- PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/, -+ PORT: /\A[\x09\x0a\x0c\x0d ]*+\d*[\x09\x0a\x0c\x0d ]*\z/, - } - end - -diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb -index 721e05e..cee0acb 100644 ---- a/test/uri/test_parser.rb -+++ b/test/uri/test_parser.rb -@@ -91,4 +91,14 @@ class URI::TestParser < Test::Unit::TestCase - end - end - end -+ -+ def test_rfc3986_port_check -+ pre = ->(length) {"\t" * length + "a"} -+ uri = URI.parse("http://my.example.com") -+ assert_linear_performance((1..5).map {|i| 10**i}, pre: pre) do |port| -+ assert_raise(URI::InvalidComponentError) do -+ uri.port = port -+ end -+ end -+ end - end --- -2.25.1 - diff --git a/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27219.patch b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27219.patch new file mode 100644 index 0000000000..7813a6143c --- /dev/null +++ b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27219.patch @@ -0,0 +1,31 @@ +From 9907b76dad0777ee300de236dad4b559e07596ab Mon Sep 17 00:00:00 2001 +From: Hiroshi SHIBATA <hsbt@ruby-lang.org> +Date: Fri, 21 Feb 2025 16:01:17 +0900 +Subject: [PATCH] Use String#concat instead of String#+ for reducing cpu usage + +Co-authored-by: "Yusuke Endoh" <mame@ruby-lang.org> + +Upstream-Status: Backport [https://github.com/ruby/cgi/commit/9907b76dad0777ee300de236dad4b559e07596ab] +CVE: CVE-2025-27219 +Signed-off-by: Ashish Sharma <asharma@mvista.com> + + lib/cgi/cookie.rb | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb +index 9498e2f..1c4ef6a 100644 +--- a/lib/cgi/cookie.rb ++++ b/lib/cgi/cookie.rb +@@ -190,9 +190,10 @@ def self.parse(raw_cookie) + values ||= "" + values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) } + if cookies.has_key?(name) +- values = cookies[name].value + values ++ cookies[name].concat(values) ++ else ++ cookies[name] = Cookie.new(name, *values) + end +- cookies[name] = Cookie.new(name, *values) + end + + cookies diff --git a/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27220.patch b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27220.patch new file mode 100644 index 0000000000..f2f8bc7f76 --- /dev/null +++ b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27220.patch @@ -0,0 +1,78 @@ +From cd1eb08076c8b8e310d4d553d427763f2577a1b6 Mon Sep 17 00:00:00 2001 +From: Hiroshi SHIBATA <hsbt@ruby-lang.org> +Date: Fri, 21 Feb 2025 15:53:31 +0900 +Subject: [PATCH] Escape/unescape unclosed tags as well + +Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> + +CVE: CVE-2025-27220 + +Upstream-Status: Backport [https://github.com/ruby/cgi/commit/cd1eb08076c8b8e310d4d553d427763f2577a1b6] + +Signed-off-by: Divya Chellam <divya.chellam@windriver.com> +--- + lib/cgi/util.rb | 4 ++-- + test/cgi/test_cgi_util.rb | 18 ++++++++++++++++++ + 2 files changed, 20 insertions(+), 2 deletions(-) + +diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb +index 4986e54..5f12eae 100644 +--- a/lib/cgi/util.rb ++++ b/lib/cgi/util.rb +@@ -184,7 +184,7 @@ module CGI::Util + def escapeElement(string, *elements) + elements = elements[0] if elements[0].kind_of?(Array) + unless elements.empty? +- string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do ++ string.gsub(/<\/?(?:#{elements.join("|")})\b[^<>]*+>?/im) do + CGI.escapeHTML($&) + end + else +@@ -204,7 +204,7 @@ module CGI::Util + def unescapeElement(string, *elements) + elements = elements[0] if elements[0].kind_of?(Array) + unless elements.empty? +- string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do ++ string.gsub(/<\/?(?:#{elements.join("|")})\b(?>[^&]+|&(?![gl]t;)\w+;)*(?:>)?/im) do + unescapeHTML($&) + end + else +diff --git a/test/cgi/test_cgi_util.rb b/test/cgi/test_cgi_util.rb +index b0612fc..bff77f7 100644 +--- a/test/cgi/test_cgi_util.rb ++++ b/test/cgi/test_cgi_util.rb +@@ -269,6 +269,14 @@ class CGIUtilTest < Test::Unit::TestCase + assert_equal("<BR><A HREF="url"></A>", escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])) + assert_equal("<BR><A HREF="url"></A>", escape_element('<BR><A HREF="url"></A>', "A", "IMG")) + assert_equal("<BR><A HREF="url"></A>", escape_element('<BR><A HREF="url"></A>', ["A", "IMG"])) ++ ++ assert_equal("<A <A HREF="url"></A>", escapeElement('<A <A HREF="url"></A>', "A", "IMG")) ++ assert_equal("<A <A HREF="url"></A>", escapeElement('<A <A HREF="url"></A>', ["A", "IMG"])) ++ assert_equal("<A <A HREF="url"></A>", escape_element('<A <A HREF="url"></A>', "A", "IMG")) ++ assert_equal("<A <A HREF="url"></A>", escape_element('<A <A HREF="url"></A>', ["A", "IMG"])) ++ ++ assert_equal("<A <A ", escapeElement('<A <A ', "A", "IMG")) ++ assert_equal("<A <A ", escapeElement('<A <A ', ["A", "IMG"])) + end + + +@@ -277,6 +285,16 @@ class CGIUtilTest < Test::Unit::TestCase + assert_equal('<BR><A HREF="url"></A>', unescapeElement(escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])) + assert_equal('<BR><A HREF="url"></A>', unescape_element(escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")) + assert_equal('<BR><A HREF="url"></A>', unescape_element(escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])) ++ ++ assert_equal('<A <A HREF="url"></A>', unescapeElement(escapeHTML('<A <A HREF="url"></A>'), "A", "IMG")) ++ assert_equal('<A <A HREF="url"></A>', unescapeElement(escapeHTML('<A <A HREF="url"></A>'), ["A", "IMG"])) ++ assert_equal('<A <A HREF="url"></A>', unescape_element(escapeHTML('<A <A HREF="url"></A>'), "A", "IMG")) ++ assert_equal('<A <A HREF="url"></A>', unescape_element(escapeHTML('<A <A HREF="url"></A>'), ["A", "IMG"])) ++ ++ assert_equal('<A <A ', unescapeElement(escapeHTML('<A <A '), "A", "IMG")) ++ assert_equal('<A <A ', unescapeElement(escapeHTML('<A <A '), ["A", "IMG"])) ++ assert_equal('<A <A ', unescape_element(escapeHTML('<A <A '), "A", "IMG")) ++ assert_equal('<A <A ', unescape_element(escapeHTML('<A <A '), ["A", "IMG"])) + end + end + +-- +2.40.0 + diff --git a/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27221-0001.patch b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27221-0001.patch new file mode 100644 index 0000000000..95802d04f9 --- /dev/null +++ b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27221-0001.patch @@ -0,0 +1,57 @@ +From 3675494839112b64d5f082a9068237b277ed1495 Mon Sep 17 00:00:00 2001 +From: Hiroshi SHIBATA <hsbt@ruby-lang.org> +Date: Fri, 21 Feb 2025 16:29:36 +0900 +Subject: [PATCH] Truncate userinfo with URI#join, URI#merge and URI#+ + +CVE: CVE-2025-27221 + +Upstream-Status: Backport [https://github.com/ruby/uri/commit/3675494839112b64d5f082a9068237b277ed1495] + +Signed-off-by: Divya Chellam <divya.chellam@windriver.com> +--- + lib/uri/generic.rb | 6 +++++- + test/uri/test_generic.rb | 11 +++++++++++ + 2 files changed, 16 insertions(+), 1 deletion(-) + +diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb +index f3540a2..ecc78c5 100644 +--- a/lib/uri/generic.rb ++++ b/lib/uri/generic.rb +@@ -1141,7 +1141,11 @@ module URI + end + + # RFC2396, Section 5.2, 7) +- base.set_userinfo(rel.userinfo) if rel.userinfo ++ if rel.userinfo ++ base.set_userinfo(rel.userinfo) ++ else ++ base.set_userinfo(nil) ++ end + base.set_host(rel.host) if rel.host + base.set_port(rel.port) if rel.port + base.query = rel.query if rel.query +diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb +index e661937..17ba2b6 100644 +--- a/test/uri/test_generic.rb ++++ b/test/uri/test_generic.rb +@@ -164,6 +164,17 @@ class URI::TestGeneric < Test::Unit::TestCase + # must be empty string to identify as path-abempty, not path-absolute + assert_equal('', url.host) + assert_equal('http:////example.com', url.to_s) ++ ++ # sec-2957667 ++ url = URI.parse('http://user:pass@example.com').merge('//example.net') ++ assert_equal('http://example.net', url.to_s) ++ assert_nil(url.userinfo) ++ url = URI.join('http://user:pass@example.com', '//example.net') ++ assert_equal('http://example.net', url.to_s) ++ assert_nil(url.userinfo) ++ url = URI.parse('http://user:pass@example.com') + '//example.net' ++ assert_equal('http://example.net', url.to_s) ++ assert_nil(url.userinfo) + end + + def test_parse_scheme_with_symbols +-- +2.40.0 + diff --git a/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27221-0002.patch b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27221-0002.patch new file mode 100644 index 0000000000..4435b87c34 --- /dev/null +++ b/poky/meta/recipes-devtools/ruby/ruby/CVE-2025-27221-0002.patch @@ -0,0 +1,73 @@ +From 2789182478f42ccbb62197f952eb730e4f02bfc5 Mon Sep 17 00:00:00 2001 +From: Hiroshi SHIBATA <hsbt@ruby-lang.org> +Date: Fri, 21 Feb 2025 18:16:28 +0900 +Subject: [PATCH] Fix merger of URI with authority component + +https://hackerone.com/reports/2957667 + +Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> + +CVE: CVE-2025-27221 + +Upstream-Status: Backport [https://github.com/ruby/uri/commit/2789182478f42ccbb62197f952eb730e4f02bfc5] + +Signed-off-by: Divya Chellam <divya.chellam@windriver.com> +--- + lib/uri/generic.rb | 19 +++++++------------ + test/uri/test_generic.rb | 7 +++++++ + 2 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb +index ecc78c5..2c0a88d 100644 +--- a/lib/uri/generic.rb ++++ b/lib/uri/generic.rb +@@ -1133,21 +1133,16 @@ module URI + base.fragment=(nil) + + # RFC2396, Section 5.2, 4) +- if !authority +- base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path +- else +- # RFC2396, Section 5.2, 4) +- base.set_path(rel.path) if rel.path ++ if authority ++ base.set_userinfo(rel.userinfo) ++ base.set_host(rel.host) ++ base.set_port(rel.port || base.default_port) ++ base.set_path(rel.path) ++ elsif base.path && rel.path ++ base.set_path(merge_path(base.path, rel.path)) + end + + # RFC2396, Section 5.2, 7) +- if rel.userinfo +- base.set_userinfo(rel.userinfo) +- else +- base.set_userinfo(nil) +- end +- base.set_host(rel.host) if rel.host +- base.set_port(rel.port) if rel.port + base.query = rel.query if rel.query + base.fragment=(rel.fragment) if rel.fragment + +diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb +index 17ba2b6..1a70dd4 100644 +--- a/test/uri/test_generic.rb ++++ b/test/uri/test_generic.rb +@@ -267,6 +267,13 @@ class URI::TestGeneric < Test::Unit::TestCase + assert_equal(u0, u1) + end + ++ def test_merge_authority ++ u = URI.parse('http://user:pass@example.com:8080') ++ u0 = URI.parse('http://new.example.org/path') ++ u1 = u.merge('//new.example.org/path') ++ assert_equal(u0, u1) ++ end ++ + def test_route + url = URI.parse('http://hoge/a.html').route_to('http://hoge/b.html') + assert_equal('b.html', url.to_s) +-- +2.40.0 + diff --git a/poky/meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch b/poky/meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch deleted file mode 100644 index b78e3db892..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/remove_has_include_macros.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e74b57febec9bd806e29025e6eeb8091e7021d75 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 26 Jan 2020 11:27:40 -0800 -Subject: [PATCH] Filter out __has_include* compiler defines - -They are internal to compiler and this header is later on includes in C -files, but newer gcc >= 10 complains about it. - -error in initial header file: -| In file included from /tmp/20200124-86625-14hiju4.c:1: -| /tmp/20200124-86625-11y6l6i.h:13849:9: error: "__has_include" cannot be used as a macro name -| 13849 | #define __has_include __has_include -| | ^~~~~~~~~~~~~ -| compilation terminated due to -Wfatal-errors. - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- - common.mk | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/common.mk b/common.mk -index 664f750..3b8fbe6 100644 ---- a/common.mk -+++ b/common.mk -@@ -238,6 +238,8 @@ $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time: probes.h vm.$(OBJE - $(ECHO) building $(@F:.time=.h) - $(Q)$(MINIRUBY) $(tooldir)/mjit_tabs.rb "$(MJIT_TABS)" \ - $(CPP) -DMJIT_HEADER $(MJIT_HEADER_FLAGS) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/vm.c $(CPPOUTFLAG)$(@F:.time=.h).new -+ $(Q)sed -i -e "/#define __has_include __has_include/d" $(@F:.time=.h).new -+ $(Q)sed -i -e "/#define __has_include_next __has_include_next/d" $(@F:.time=.h).new - $(Q) $(IFCHANGE) "--timestamp=$@" $(@F:.time=.h) $(@F:.time=.h).new - - $(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).h: $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time diff --git a/poky/meta/recipes-devtools/ruby/ruby/run-ptest b/poky/meta/recipes-devtools/ruby/ruby/run-ptest index de7c415aba..17404e3509 100644 --- a/poky/meta/recipes-devtools/ruby/ruby/run-ptest +++ b/poky/meta/recipes-devtools/ruby/ruby/run-ptest @@ -1,6 +1,6 @@ #!/bin/sh -test_fullname=`find test -name test_*.rb` +test_fullname=$(find test -name test_*.rb | grep -v '/-ext-/') for i in ${test_fullname}; do ruby ./test/runner.rb ${i} 2>&1 > /dev/null diff --git a/poky/meta/recipes-devtools/ruby/ruby_3.2.2.bb b/poky/meta/recipes-devtools/ruby/ruby_3.3.5.bb index d1359e388c..8b45946f6b 100644 --- a/poky/meta/recipes-devtools/ruby/ruby_3.2.2.bb +++ b/poky/meta/recipes-devtools/ruby/ruby_3.3.5.bb @@ -10,7 +10,7 @@ LICENSE = "Ruby | BSD-2-Clause | BSD-3-Clause | GPL-2.0-only | ISC | MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=5b8c87559868796979806100db3f3805 \ file://BSDL;md5=8b50bc6de8f586dc66790ba11d064d75 \ file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LEGAL;md5=bcd74b47bbaf2051c5e49811a5faa97a \ + file://LEGAL;md5=81e6a4d81533b9263da4c3485a0ad883 \ " DEPENDS = "zlib openssl libyaml gdbm readline libffi" @@ -20,20 +20,18 @@ DEPENDS:append:class-nativesdk = " ruby-native" SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \ file://0001-extmk-fix-cross-compilation-of-external-gems.patch \ - file://0002-Obey-LDFLAGS-for-the-link-of-libruby.patch \ - file://remove_has_include_macros.patch \ file://run-ptest \ - file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \ - file://0002-template-Makefile.in-filter-out-f-prefix-map.patch \ file://0003-rdoc-build-reproducible-documentation.patch \ file://0004-lib-mkmf.rb-sort-list-of-object-files-in-generated-M.patch \ file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \ file://0006-Make-gemspecs-reproducible.patch \ file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \ - file://0001-fiddle-Use-C11-_Alignof-to-define-ALIGN_OF-when-poss.patch \ - file://CVE-2023-36617_1.patch \ - file://CVE-2023-36617_2.patch \ - " + file://CVE-2025-27219.patch \ + file://CVE-2025-27220.patch \ + file://CVE-2025-27221-0001.patch \ + file://CVE-2025-27221-0002.patch \ + file://0007-Skip-test_rm_r_no_permissions-test-under-root.patch \ + " UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" inherit autotools ptest pkgconfig @@ -53,7 +51,7 @@ do_configure:prepend() { DEPENDS:append:libc-musl = " libucontext" -SRC_URI[sha256sum] = "96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc" +SRC_URI[sha256sum] = "3781a3504222c2f26cb4b9eb9c1a12dbf4944d366ce24a9ff8cf99ecbce75196" PACKAGECONFIG ??= "" PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" @@ -73,6 +71,7 @@ EXTRA_OECONF = "\ --enable-load-relative \ --with-pkg-config=pkg-config \ --with-static-linked-ext \ + --with-mantype=man \ " EXTRA_OECONF:append:libc-musl = "\ @@ -104,11 +103,13 @@ do_install:append:class-target () { do_install_ptest () { cp -rf ${S}/test ${D}${PTEST_PATH}/ - + install -D ${S}/tool/test/init.rb ${D}${PTEST_PATH}/tool/test/init.rb install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/ mkdir -p ${D}${PTEST_PATH}/lib cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib + cp ${D}${libdir}/ruby/${SHRT_VER}.0/rdoc.rb ${D}${PTEST_PATH}/lib + cp ${D}${libdir}/ruby/${SHRT_VER}.0/did_you_mean.rb ${D}${PTEST_PATH}/lib # install test-binaries # These .so files have sporadic reproducibility fails as seen here: |
