提交 ef9f0537 编写于 作者: A Aaron Patterson

stop calling to_sym when building arel nodes [CVE-2013-1854]

上级 dad31097
......@@ -2307,7 +2307,7 @@ def aggregate_mapping(reflection)
def expand_hash_conditions_for_aggregates(attrs)
expanded_attrs = {}
attrs.each do |attr, value|
unless (aggregation = reflect_on_aggregation(attr.to_sym)).nil?
unless (aggregation = reflect_on_aggregation(attr)).nil?
mapping = aggregate_mapping(aggregation)
mapping.each do |field_attr, aggregate_attr|
if mapping.size == 1 && !value.respond_to?(aggregate_attr)
......
......@@ -18,7 +18,7 @@ def create_reflection(macro, name, options, active_record)
when :composed_of
reflection = AggregateReflection.new(macro, name, options, active_record)
end
write_inheritable_hash :reflections, name => reflection
write_inheritable_hiwa :reflections, name => reflection
reflection
end
......
......@@ -109,6 +109,11 @@ def write_inheritable_hash(key, hash)
write_inheritable_attribute(key, read_inheritable_attribute(key).merge(hash))
end
def write_inheritable_hiwa(key, hash)
write_inheritable_attribute(key, {}.with_indifferent_access) if read_inheritable_attribute(key).nil?
write_inheritable_attribute(key, read_inheritable_attribute(key).merge(hash))
end
def read_inheritable_attribute(key)
inheritable_attributes[key]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册