Skip to content

Commit 5c23a73

Browse files
committed
mark possibly problematic spots with FIXME
1 parent 59ca07b commit 5c23a73

File tree

9 files changed

+15
-0
lines changed

9 files changed

+15
-0
lines changed

lib/coderay/encoders/html.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def self.make_html_escape_hash
142142
HTML_ESCAPE = make_html_escape_hash
143143
HTML_ESCAPE_PATTERN = /[\t"&><\0-\x8\xB-\x1F]/
144144

145+
# FIXME: cache attack
145146
TOKEN_KIND_TO_INFO = Hash.new do |h, kind|
146147
h[kind] = kind.to_s.gsub(/_/, ' ').gsub(/\b\w/) { $&.capitalize }
147148
end
@@ -284,6 +285,7 @@ def style_for_kinds kinds
284285
end
285286

286287
def make_span_for_kinds method, hint
288+
# FIXME: cache attack
287289
Hash.new do |h, kinds|
288290
h[kinds.is_a?(Symbol) ? kinds : kinds.dup] = begin
289291
css_class = css_class_for_kinds(kinds)

lib/coderay/encoders/html/css.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def initialize style = :default
2121
end
2222

2323
def get_style_for_css_classes css_classes
24+
# FIXME: cache attack
2425
cl = @styles[css_classes.first]
2526
return '' unless cl
2627
style = ''
@@ -52,6 +53,7 @@ def parse stylesheet
5253
for selector in selectors.split(',')
5354
classes = selector.scan(/[-\w]+/)
5455
cl = classes.pop
56+
# FIXME: cache attack
5557
@styles[cl] ||= Hash.new
5658
@styles[cl][classes] = style.to_s.strip.delete(' ').chomp(';')
5759
end

lib/coderay/helpers/file_type.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def shebang filename
6868
File.open filename, 'r' do |f|
6969
if first_line = f.gets
7070
if type = first_line[TypeFromShebang]
71+
# FIXME: cache attack
7172
type.to_sym
7273
end
7374
end

lib/coderay/helpers/plugin.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def validate_id id
207207
id
208208
elsif id.is_a? String
209209
if id[/\w+/] == id
210+
# FIXME: cache attack
210211
id.downcase.to_sym
211212
else
212213
raise ArgumentError, "Invalid id given: #{id}"

lib/coderay/scanners/debug.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def scan_tokens encoder, options
2121
encoder.text_token match, :space
2222

2323
elsif match = scan(/ (\w+) \( ( [^\)\\]* ( \\. [^\)\\]* )* ) \)? /x)
24+
# FIXME: cache attack
2425
kind = self[1].to_sym
2526
match = self[2].gsub(/\\(.)/m, '\1')
2627
unless TokenKinds.has_key? kind
@@ -30,6 +31,7 @@ def scan_tokens encoder, options
3031
encoder.text_token match, kind
3132

3233
elsif match = scan(/ (\w+) ([<\[]) /x)
34+
# FIXME: cache attack
3335
kind = self[1].to_sym
3436
opened_tokens << kind
3537
case self[2]

lib/coderay/scanners/diff.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def scan_tokens encoder, options
2121
line_kind = nil
2222
state = :initial
2323
deleted_lines_count = 0
24+
# FIXME: cache attack
2425
scanners = Hash.new do |h, lang|
2526
h[lang] = Scanners[lang].new '', :keep_tokens => true, :keep_state => true
2627
end

lib/coderay/scanners/python.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ class Python < Scanner
7575
<<=? | >>=? | [<>=]=? | != # comparison and assignment
7676
/x # :nodoc:
7777

78+
# FIXME: cache attack
7879
STRING_DELIMITER_REGEXP = Hash.new { |h, delimiter|
7980
h[delimiter] = Regexp.union delimiter # :nodoc:
8081
}
8182

83+
# FIXME: cache attack
8284
STRING_CONTENT_REGEXP = Hash.new { |h, delimiter|
8385
h[delimiter] = / [^\\\n]+? (?= \\ | $ | #{Regexp.escape(delimiter)} ) /x # :nodoc:
8486
}
@@ -183,6 +185,7 @@ def scan_tokens encoder, options
183185
kind = :ident
184186
elsif kind == :keyword
185187
state = DEF_NEW_STATE[match]
188+
# FIXME: cache attack
186189
from_import_state << match.to_sym if state == :include_expected
187190
end
188191
encoder.text_token match, kind

lib/coderay/scanners/raydebug.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def scan_tokens encoder, options
2626
encoder.text_token kind, :class
2727
encoder.text_token '(', :operator
2828
match = self[2]
29+
# FIXME: cache attack
2930
encoder.text_token match, kind.to_sym unless match.empty?
3031
encoder.text_token match, :operator if match = scan(/\)/)
3132

@@ -39,6 +40,7 @@ def scan_tokens encoder, options
3940
else
4041
raise 'CodeRay bug: This case should not be reached.'
4142
end
43+
# FIXME: cache attack
4244
kind = kind.to_sym
4345
opened_tokens << kind
4446
encoder.begin_group kind

lib/coderay/scanners/ruby/string_state.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class StringState < Struct.new :type, :interpreted, :delim, :heredoc,
1414
{ }
1515
] ].each { |k,v| k.freeze; v.freeze } # debug, if I try to change it with <<
1616

17+
# FIXME: cache attack
1718
STRING_PATTERN = Hash.new do |h, k|
1819
delim, interpreted = *k
1920
# delim = delim.dup # workaround for old Ruby

0 commit comments

Comments
 (0)