* array.c (recursive_hash): reject recursive key.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-07-17 07:49:06 +00:00
parent 003fa83e0c
commit 0101958745
3 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,7 @@
Fri Jul 17 16:45:22 2009 Tanaka Akira <akr@fsij.org>
* array.c (recursive_hash): reject recursive key.
Fri Jul 17 15:20:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* random.c (DIGSPERINT): fix for LP64.

View File

@ -2884,7 +2884,7 @@ recursive_hash(VALUE ary, VALUE dummy, int recur)
VALUE n;
if (recur) {
return LONG2FIX(0);
rb_raise(rb_eArgError, "recursive key for hash");
}
h = rb_hash_start(RARRAY_LEN(ary));
for (i=0; i<RARRAY_LEN(ary); i++) {

View File

@ -1572,9 +1572,7 @@ class TestArray < Test::Unit::TestCase
def test_hash2
a = []
a << a
b = []
b << b
assert_equal(a.hash, b.hash)
assert_raise(ArgumentError) { a.hash }
end
def test_flatten2