Merge pull request #287 from github/jhongturney/codeql-fixes
limiting group matches to 1000 chars at most
This commit is contained in:
Коммит
6bd39637ba
|
@ -307,10 +307,7 @@ module OctocatalogDiff
|
|||
# @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)
|
||||
|
|
|
@ -155,10 +155,7 @@ module OctocatalogDiff
|
|||
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'
|
||||
|
|
Загрузка…
Ссылка в новой задаче