summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch')
-rw-r--r--meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch73
1 files changed, 73 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 @@
1From 957bb7cb81995f26c671afce0ee50a5c660e540e Mon Sep 17 00:00:00 2001
2From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
3Date: Wed, 29 Mar 2023 13:28:25 +0900
4Subject: [PATCH] CVE-2023-28756
5
6CVE: CVE-2023-28756
7Upstream-Status: Backport [https://github.com/ruby/ruby/commit/957bb7cb81995f26c671afce0ee50a5c660e540e]
8Signed-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
15diff --git a/lib/time.gemspec b/lib/time.gemspec
16index 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
27diff --git a/lib/time.rb b/lib/time.rb
28index 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'
51diff --git a/test/test_time.rb b/test/test_time.rb
52index 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--
722.25.1
73