Merge pull request #287 from github/jhongturney/codeql-fixes

limiting group matches to 1000 chars at most
This commit is contained in:
Jason Hong-Turney 2024-03-01 10:22:37 -08:00 коммит произвёл GitHub
Родитель 6b8384587f 8a5c486731
Коммит 6bd39637ba
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 2 добавлений и 8 удалений

Просмотреть файл

@ -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'