From a28a060db41415c1c1dad3e554ff2c865a20ebca Mon Sep 17 00:00:00 2001 From: glass Date: Sun, 4 Nov 2012 02:44:58 +0000 Subject: * array.c (recursive_equal): fix to return true when self and other are resized to same size and the current index become out of range. * test/ruby/test_array.rb: add a test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'array.c') diff --git a/array.c b/array.c index f4750696fd..1d526644c7 100644 --- a/array.c +++ b/array.c @@ -3282,8 +3282,10 @@ recursive_equal(VALUE ary1, VALUE ary2, int recur) if (*p1 != *p2) { if (rb_equal(*p1, *p2)) { len1 = RARRAY_LEN(ary1); - if (len1 != RARRAY_LEN(ary2) || len1 < i) + if (len1 != RARRAY_LEN(ary2)) return Qfalse; + if (len1 < i) + return Qtrue; p1 = RARRAY_PTR(ary1) + i; p2 = RARRAY_PTR(ary2) + i; } -- cgit v1.2.3