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)
307
307
# @param string_in [String] Input string, which might contain trailing whitespace
308
308
# @return [String] Modified string
309
309
def self . make_trailing_whitespace_visible ( string_in )
310
+ if string_in . length > 1000
311
+ raise ArgumentError , "Input string too long"
312
+ end
310
313
return string_in unless string_in =~ /\A ((?:.|\n )*?)(\s +)(\e \[ 0m)?\Z /
311
314
beginning = Regexp . last_match ( 1 )
312
315
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)
155
155
elsif options [ :fact_file ]
156
156
raise Errno ::ENOENT , "Fact file #{ options [ :fact_file ] } does not exist" unless File . file? ( options [ :fact_file ] )
157
157
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
158
161
fact_file_opts [ :backend ] = Regexp . last_match ( 1 ) . to_sym if options [ :fact_file ] =~ /.*\. (\w +)$/
159
162
OctocatalogDiff ::Facts . new ( fact_file_opts )
160
163
else
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def file_content(filename)
21
21
@fc ||= { }
22
22
@fc [ filename ] ||= begin
23
23
comments = [ ]
24
- IO . readlines ( filename ) . each do |line |
24
+ File . readlines ( filename ) . each do |line |
25
25
next if line =~ /^#\s *@/
26
26
next if line . strip == '# frozen_string_literal: true'
27
27
if line =~ /^#(.+)/
You can’t perform that action at this time.
0 commit comments