Skip to content

Commit

Permalink
merge revision(s) a7f5d6ab88 c9ab8fe [Backport#17877]
Browse files Browse the repository at this point in the history
	a fix of RDoc for CVE-2021-31799
  • Loading branch information
unak committed May 31, 2021
1 parent d8bbbc3 commit 483f303
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rdoc/rdoc.rb
Expand Up @@ -430,7 +430,7 @@ def remove_unparseable files
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
Expand Down
13 changes: 13 additions & 0 deletions test/rdoc/test_rdoc_rdoc.rb
Expand Up @@ -426,6 +426,19 @@ def test_remove_unparseable_tags_vim
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'
Expand Down
2 changes: 1 addition & 1 deletion version.h
Expand Up @@ -2,7 +2,7 @@
# 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
Expand Down

0 comments on commit 483f303

Please sign in to comment.