tfpt review “/shelveset:HashFixes;REDMOND\tomat”
Fixes implementation of hash methods in REXML and RubyGems. The
current implementation is incorrect since it sums hash codes of
subcomponents potentially overflowing to Bignum. This issue is mainly
exposed when calculating hash of an array. Array#hash calculates its
hash code by calling hash on each item and converting the result of the
hash method into Fixnum. So if the result if the hash method is a Bignum
an error is reported:
class C
def hash
100000000000000000000
end
end
[C.new].hash # => in hash': bignum too big to convert into
long’
(RangeError)
Tomas