Skip to content

Commit 390e923

Browse files
committed
merge revision(s) r46368,r46371: [Backport ruby#9913]
* ext/digest/digest.c (rb_digest_instance_equal): fix #== for non-string arguments. [ruby-core:62967] [Bug ruby#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 ruby#9913] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent b373075 commit 390e923

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Sun Jul 13 23:18:11 2014 Nobuyoshi Nakada <[email protected]>
2+
3+
* ext/digest/digest.c (rb_digest_instance_equal): no need to call
4+
`to_s` twice. [Bug #9913]
5+
6+
Sun Jul 13 23:18:11 2014 Benoit Daloze <[email protected]>
7+
8+
* ext/digest/digest.c (rb_digest_instance_equal):
9+
fix #== for non-string arguments. [ruby-core:62967] [Bug #9913]
10+
11+
* test/digest/test_digest.rb: add test for above.
12+
113
Sun Jul 13 23:10:03 2014 Nobuyoshi Nakada <[email protected]>
214

315
* array.c (yield_indexed_values): extract from permute0(),

ext/digest/digest.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ rb_digest_instance_equal(VALUE self, VALUE other)
372372
str2 = rb_digest_instance_digest(0, 0, other);
373373
} else {
374374
str1 = rb_digest_instance_to_s(self);
375-
str2 = other;
375+
str2 = rb_check_string_type(other);
376+
if (NIL_P(str2)) return Qfalse;
376377
}
377378

378379
/* never blindly assume that subclass methods return strings */

test/digest/test_digest.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ def test_eq
6969

7070
assert_equal(md1, md1.clone, self.class::ALGO)
7171

72+
bug9913 = '[ruby-core:62967] [Bug #9913]'
73+
assert_not_equal(md1, nil, bug9913)
74+
7275
md2 = self.class::ALGO.new
7376
md2 << "A"
7477

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.2"
22
#define RUBY_RELEASE_DATE "2014-07-13"
3-
#define RUBY_PATCHLEVEL 173
3+
#define RUBY_PATCHLEVEL 174
44

55
#define RUBY_RELEASE_YEAR 2014
66
#define RUBY_RELEASE_MONTH 7

0 commit comments

Comments
 (0)