diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-31 07:11:29 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-31 07:11:29 +0000 |
commit | a102b685b93f0ce944c273e24f7d100e85777426 (patch) | |
tree | 882079486f52e2391afffcc099ec2d4f333bc698 /ext | |
parent | bea02d1b35a389cd70f349183776cc96be29abc2 (diff) |
merge revision(s) 46368,46371: [Backport #9913]
* ext/digest/digest.c (rb_digest_instance_equal):
fix #== for non-string arguments. [ruby-core:62967] [Bug #9913]
* test/digest/test_digest.rb: add test for above.
* ext/digest/digest.c (rb_digest_instance_equal): no need to call
`to_s` twice. [Bug #9913]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/digest/digest.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c index c603441409..02fc12bd63 100644 --- a/ext/digest/digest.c +++ b/ext/digest/digest.c @@ -356,7 +356,8 @@ rb_digest_instance_equal(VALUE self, VALUE other) str2 = rb_digest_instance_digest(0, 0, other); } else { str1 = rb_digest_instance_to_s(self); - str2 = other; + str2 = rb_check_string_type(other); + if (NIL_P(str2)) return Qfalse; } /* never blindly assume that subclass methods return strings */ |