[前][次][番号順一覧][スレッド一覧]

ruby-changes:66377

From: NAKAMURA <ko1@a...>
Date: Mon, 31 May 2021 23:46:27 +0900 (JST)
Subject: [ruby-changes:66377] 483f303d02 (ruby_2_7): merge revision(s) a7f5d6ab88 c9ab8fe2 [Backport#17877]

https://git.ruby-lang.org/ruby.git/commit/?id=483f303d02

From 483f303d02e768b69e476e0b9be4ab2f26389522 Mon Sep 17 00:00:00 2001
From: NAKAMURA Usaku <usa@r...>
Date: Mon, 31 May 2021 23:44:23 +0900
Subject: merge revision(s) a7f5d6ab88 c9ab8fe2 [Backport#17877]

	a fix of RDoc for CVE-2021-31799
---
 lib/rdoc/rdoc.rb            |  2 +-
 test/rdoc/test_rdoc_rdoc.rb | 13 +++++++++++++
 version.h                   |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index c60e017..f356c36 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -430,7 +430,7 @@ The internal error was: https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.rb#L430
     files.reject do |file|
       file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
         (file =~ /tags$/i and
-         open(file, 'rb') { |io|
+         File.open(file, 'rb') { |io|
            io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
          })
     end
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index f2cc901..f3228c3 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -426,6 +426,19 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L426
     end
   end
 
+  def test_remove_unparseable_CVE_2021_31799
+    omit 'for Un*x platforms' if Gem.win_platform?
+    temp_dir do
+      file_list = ['| touch evil.txt && echo tags']
+      file_list.each do |f|
+        FileUtils.touch f
+      end
+
+      assert_equal file_list, @rdoc.remove_unparseable(file_list)
+      assert_equal file_list, Dir.children('.')
+    end
+  end
+
   def test_setup_output_dir
     Dir.mktmpdir {|d|
       path = File.join d, 'testdir'
diff --git a/version.h b/version.h
index 4e5e6f3..e825e59 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L2
 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
 #define RUBY_VERSION_TEENY 4
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 187
+#define RUBY_PATCHLEVEL 188
 
 #define RUBY_RELEASE_YEAR 2021
 #define RUBY_RELEASE_MONTH 5
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]