File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,9 @@ 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
310313 return string_in unless string_in =~ /\A ((?:.|\n )*?)(\s +)(\e \[ 0m)?\Z /
311314 beginning = Regexp . last_match ( 1 )
312315 trailing_space = Regexp . last_match ( 2 )
Original file line number Diff line number Diff line change @@ -155,6 +155,9 @@ 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
158161 fact_file_opts [ :backend ] = Regexp . last_match ( 1 ) . to_sym if options [ :fact_file ] =~ /.*\. (\w +)$/
159162 OctocatalogDiff ::Facts . new ( fact_file_opts )
160163 else
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def file_content(filename)
2121 @fc ||= { }
2222 @fc [ filename ] ||= begin
2323 comments = [ ]
24- IO . readlines ( filename ) . each do |line |
24+ File . readlines ( filename ) . each do |line |
2525 next if line =~ /^#\s *@/
2626 next if line . strip == '# frozen_string_literal: true'
2727 if line =~ /^#(.+)/
You can’t perform that action at this time.
0 commit comments