Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limiting group matches to 1000 chars at most #287

Merged
merged 4 commits into from
Mar 1, 2024
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
5 changes: 1 addition & 4 deletions lib/octocatalog-diff/catalog-diff/display/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ def self.adjust_position_of_plus_minus(string_in)
# @param string_in [String] Input string, which might contain trailing whitespace
# @return [String] Modified string
def self.make_trailing_whitespace_visible(string_in)
if string_in.length > 1000
raise ArgumentError, "Input string too long"
end
return string_in unless string_in =~ /\A((?:.|\n)*?)(\s+)(\e\[0m)?\Z/
return string_in unless string_in =~ /\A((?:.|\n){1,1000}?)(\s+)(\e\[0m)?\Z/
beginning = Regexp.last_match(1)
trailing_space = Regexp.last_match(2)
end_escape = Regexp.last_match(3)
Expand Down
5 changes: 1 addition & 4 deletions lib/octocatalog-diff/catalog-util/builddir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ def install_fact_file(logger, options)
elsif options[:fact_file]
raise Errno::ENOENT, "Fact file #{options[:fact_file]} does not exist" unless File.file?(options[:fact_file])
fact_file_opts = { fact_file_string: File.read(options[:fact_file]) }
if options[:fact_file].length > 1000
raise ArgumentError, "Input too long"
end
fact_file_opts[:backend] = Regexp.last_match(1).to_sym if options[:fact_file] =~ /.*\.(\w+)$/
fact_file_opts[:backend] = Regexp.last_match(1).to_sym if options[:fact_file] =~ /.{1,1000}\.(\w+)$/
OctocatalogDiff::Facts.new(fact_file_opts)
else
raise ArgumentError, 'No facts passed to "install_fact_file" method'
Expand Down
Loading