Skip to content

Commit 87c621c

Browse files
committed
limiting group matches to 1000 chars at most
1 parent 6b83845 commit 87c621c

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

lib/octocatalog-diff/catalog-diff/display/text.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,7 @@ def self.adjust_position_of_plus_minus(string_in)
307307
# @param string_in [String] Input string, which might contain trailing whitespace
308308
# @return [String] Modified string
309309
def self.make_trailing_whitespace_visible(string_in)
310-
if string_in.length > 1000
311-
raise ArgumentError, "Input string too long"
312-
end
313-
return string_in unless string_in =~ /\A((?:.|\n)*?)(\s+)(\e\[0m)?\Z/
310+
return string_in unless string_in =~ /\A((?:.|\n){1,1000}?)(\s+)(\e\[0m)?\Z/
314311
beginning = Regexp.last_match(1)
315312
trailing_space = Regexp.last_match(2)
316313
end_escape = Regexp.last_match(3)

lib/octocatalog-diff/catalog-util/builddir.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ def install_fact_file(logger, options)
155155
elsif options[:fact_file]
156156
raise Errno::ENOENT, "Fact file #{options[:fact_file]} does not exist" unless File.file?(options[:fact_file])
157157
fact_file_opts = { fact_file_string: File.read(options[:fact_file]) }
158-
if options[:fact_file].length > 1000
159-
raise ArgumentError, "Input too long"
160-
end
161-
fact_file_opts[:backend] = Regexp.last_match(1).to_sym if options[:fact_file] =~ /.*\.(\w+)$/
158+
fact_file_opts[:backend] = Regexp.last_match(1).to_sym if options[:fact_file] =~ /.*\.(\w{1,1000})$/
162159
OctocatalogDiff::Facts.new(fact_file_opts)
163160
else
164161
raise ArgumentError, 'No facts passed to "install_fact_file" method'

0 commit comments

Comments
 (0)