Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/_regexp.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ the potential vulnerability arising from this is the {regular expression denial-

\Regexp matching can apply an optimization to prevent ReDoS attacks.
When the optimization is applied, matching time increases linearly (not polynomially or exponentially)
in relation to the input size, and a ReDoS attach is not possible.
in relation to the input size, and a ReDoS attack is not possible.

This optimization is applied if the pattern meets these criteria:

Expand Down
12 changes: 4 additions & 8 deletions tool/commit-email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def build_diff(path, numstats)
end

def git_show(revision, format:)
git('show', "--pretty=#{format}", '--no-patch', revision).strip
git('show', '--no-show-signature', "--pretty=#{format}", '--no-patch', revision).strip
end

def git(*args)
Expand Down Expand Up @@ -180,7 +180,7 @@ def main(repo_path, to, rest)
args, options = parse(rest)

infos = args.each_slice(3).flat_map do |oldrev, newrev, refname|
revisions = IO.popen(['git', 'log', '--reverse', '--pretty=%H', "#{oldrev}^..#{newrev}"], &:read).lines.map(&:strip)
revisions = IO.popen(['git', 'log', '--no-show-signature', '--reverse', '--pretty=%H', "#{oldrev}^..#{newrev}"], &:read).lines.map(&:strip)
revisions[0..-2].zip(revisions[1..-1]).map do |old, new|
GitInfoBuilder.new(repo_path).build(old, new, refname)
end
Expand Down Expand Up @@ -211,7 +211,7 @@ def b_encode(str)
end

def make_body(info, viewer_uri:)
body = ''
body = +''
body << "#{info.author}\t#{format_time(info.date)}\n"
body << "\n"
body << " New Revision: #{info.revision}\n"
Expand Down Expand Up @@ -276,7 +276,6 @@ def modified_dirs(info)
end

def changed_dirs_info(info, uri)
rev = info.revision
(info.added_dirs.collect do |dir|
" Added: #{dir}\n"
end + info.deleted_dirs.collect do |dir|
Expand All @@ -293,14 +292,11 @@ def diff_info(info, uri)
values.collect do |type, value|
case type
when :added
command = 'cat'
rev = "?revision=#{info.revision}&view=markup"
when :modified, :property_changed
command = 'diff'
prev_revision = (info.revision.is_a?(Integer) ? info.revision - 1 : "#{info.revision}^")
rev = "?r1=#{info.revision}&r2=#{prev_revision}&diff_format=u"
when :deleted, :copied
command = 'cat'
rev = ''
else
raise "unknown diff type: #{value[:type]}"
Expand Down Expand Up @@ -328,7 +324,7 @@ def make_header(to, from, info)
end

def make_subject(info)
subject = ''
subject = +''
subject << "#{info.revision}"
subject << " (#{info.branch})"
subject << ': '
Expand Down
9 changes: 4 additions & 5 deletions tool/test/test_commit_email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ def setup
end

@sendmail = File.join(Dir.mktmpdir, 'sendmail')
File.write(@sendmail, <<~SENDMAIL)
#!/usr/bin/env ruby
print #{STDIN_DELIMITER.dump}
puts STDIN.read
File.write(@sendmail, <<~SENDMAIL, mode: "wx", perm: 0755)
#!/bin/sh
echo #{STDIN_DELIMITER.chomp.dump}
exec cat
SENDMAIL
FileUtils.chmod(0755, @sendmail)

@commit_email = File.expand_path('../../tool/commit-email.rb', __dir__)
end
Expand Down