diff options
| author | Hitendra Prajapati <hprajapati@mvista.com> | 2023-04-17 10:12:58 +0530 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-04-26 04:03:21 -1000 |
| commit | be5ebd6b3f84b9f37deb5ce38467af353da0bbbf (patch) | |
| tree | dee716e2f87412bc3325f5dafeb201c1868c920b | |
| parent | ee5ff08d87a84f957af29bdf96ef232efdb229ae (diff) | |
| download | poky-be5ebd6b3f84b9f37deb5ce38467af353da0bbbf.tar.gz | |
ruby: CVE-2023-28756 ReDoS vulnerability in Time
Upstream-Status: Backport from https://github.com/ruby/ruby/commit/957bb7cb81995f26c671afce0ee50a5c660e540e
(From OE-Core rev: 0f8eb0505e19ccd27e1b91f27285a9fc87f2aa93)
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch | 73 | ||||
| -rw-r--r-- | meta/recipes-devtools/ruby/ruby_3.1.3.bb | 1 |
2 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch b/meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch new file mode 100644 index 0000000000..cf24b13f53 --- /dev/null +++ b/meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | From 957bb7cb81995f26c671afce0ee50a5c660e540e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hiroshi SHIBATA <hsbt@ruby-lang.org> | ||
| 3 | Date: Wed, 29 Mar 2023 13:28:25 +0900 | ||
| 4 | Subject: [PATCH] CVE-2023-28756 | ||
| 5 | |||
| 6 | CVE: CVE-2023-28756 | ||
| 7 | Upstream-Status: Backport [https://github.com/ruby/ruby/commit/957bb7cb81995f26c671afce0ee50a5c660e540e] | ||
| 8 | Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> | ||
| 9 | --- | ||
| 10 | lib/time.gemspec | 2 +- | ||
| 11 | lib/time.rb | 6 +++--- | ||
| 12 | test/test_time.rb | 9 +++++++++ | ||
| 13 | 3 files changed, 13 insertions(+), 4 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/lib/time.gemspec b/lib/time.gemspec | ||
| 16 | index 72fba34..bada91a 100644 | ||
| 17 | --- a/lib/time.gemspec | ||
| 18 | +++ b/lib/time.gemspec | ||
| 19 | @@ -1,6 +1,6 @@ | ||
| 20 | Gem::Specification.new do |spec| | ||
| 21 | spec.name = "time" | ||
| 22 | - spec.version = "0.2.0" | ||
| 23 | + spec.version = "0.2.2" | ||
| 24 | spec.authors = ["Tanaka Akira"] | ||
| 25 | spec.email = ["akr@fsij.org"] | ||
| 26 | |||
| 27 | diff --git a/lib/time.rb b/lib/time.rb | ||
| 28 | index bd20a1a..6a13212 100644 | ||
| 29 | --- a/lib/time.rb | ||
| 30 | +++ b/lib/time.rb | ||
| 31 | @@ -509,8 +509,8 @@ class Time | ||
| 32 | (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+ | ||
| 33 | (\d{2,})\s+ | ||
| 34 | (\d{2})\s* | ||
| 35 | - :\s*(\d{2})\s* | ||
| 36 | - (?::\s*(\d{2}))?\s+ | ||
| 37 | + :\s*(\d{2}) | ||
| 38 | + (?:\s*:\s*(\d\d))?\s+ | ||
| 39 | ([+-]\d{4}| | ||
| 40 | UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Z])/ix =~ date | ||
| 41 | # Since RFC 2822 permit comments, the regexp has no right anchor. | ||
| 42 | @@ -701,7 +701,7 @@ class Time | ||
| 43 | # | ||
| 44 | # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise. | ||
| 45 | # | ||
| 46 | - # +fractional_digits+ specifies a number of digits to use for fractional | ||
| 47 | + # +fraction_digits+ specifies a number of digits to use for fractional | ||
| 48 | # seconds. Its default value is 0. | ||
| 49 | # | ||
| 50 | # require 'time' | ||
| 51 | diff --git a/test/test_time.rb b/test/test_time.rb | ||
| 52 | index b50d841..23e8e10 100644 | ||
| 53 | --- a/test/test_time.rb | ||
| 54 | +++ b/test/test_time.rb | ||
| 55 | @@ -62,6 +62,15 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc: | ||
| 56 | assert_equal(true, t.utc?) | ||
| 57 | end | ||
| 58 | |||
| 59 | + def test_rfc2822_nonlinear | ||
| 60 | + pre = ->(n) {"0 Feb 00 00 :00" + " " * n} | ||
| 61 | + assert_linear_performance([100, 500, 5000, 50_000], pre: pre) do |s| | ||
| 62 | + assert_raise(ArgumentError) do | ||
| 63 | + Time.rfc2822(s) | ||
| 64 | + end | ||
| 65 | + end | ||
| 66 | + end | ||
| 67 | + | ||
| 68 | if defined?(Ractor) | ||
| 69 | def test_rfc2822_ractor | ||
| 70 | assert_ractor(<<~RUBY, require: 'time') | ||
| 71 | -- | ||
| 72 | 2.25.1 | ||
| 73 | |||
diff --git a/meta/recipes-devtools/ruby/ruby_3.1.3.bb b/meta/recipes-devtools/ruby/ruby_3.1.3.bb index c8454da3a9..92efc5db91 100644 --- a/meta/recipes-devtools/ruby/ruby_3.1.3.bb +++ b/meta/recipes-devtools/ruby/ruby_3.1.3.bb | |||
| @@ -29,6 +29,7 @@ SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \ | |||
| 29 | file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \ | 29 | file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \ |
| 30 | file://0006-Make-gemspecs-reproducible.patch \ | 30 | file://0006-Make-gemspecs-reproducible.patch \ |
| 31 | file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \ | 31 | file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \ |
| 32 | file://CVE-2023-28756.patch \ | ||
| 32 | " | 33 | " |
| 33 | UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" | 34 | UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" |
| 34 | 35 | ||
