summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 04:16:51 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 04:16:51 +0000
commit95c9c1dc1596ef435a5f395fbd1016d9d221830a (patch)
treeace81e8d6e044ae6a9729320bacabb2deb227f44
parent1433d4337cdfa6422d75e83ef63b8f64fc95bf6b (diff)
* ext/bigdecimal/bigdecimal.c (BigDecimal_hash): st_index_t may not be
fixable on 64bit mswin/mingw. * ext/date/date_core.c (d_lite_hash): ditto. [Backport #13877] * ext/openssl/ossl_bn.c (ossl_bn_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--ext/bigdecimal/bigdecimal.c2
-rw-r--r--ext/date/date_core.c2
-rw-r--r--ext/openssl/ossl_bn.c2
-rw-r--r--test/bigdecimal/test_bigdecimal.rb1
-rw-r--r--test/date/test_date.rb2
-rw-r--r--test/openssl/test_bn.rb19
-rw-r--r--version.h6
8 files changed, 38 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index fb4ba3c204..ee7e705c79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Sep 14 13:14:19 2017 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_hash): st_index_t may not be
+ fixable on 64bit mswin/mingw.
+
+ * ext/date/date_core.c (d_lite_hash): ditto.
+ [Backport #13877]
+
+ * ext/openssl/ossl_bn.c (ossl_bn_hash): ditto.
+
Sat Sep 9 23:05:31 2017 Kazuki Yamaguchi <k@rhe.jp>
asn1: fix out-of-bounds read in decoding constructed objects
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 7acd94c31f..e24f05782c 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -376,7 +376,7 @@ BigDecimal_hash(VALUE self)
hash ^= rb_memhash(p->frac, sizeof(BDIGIT)*p->Prec);
hash += p->exponent;
}
- return INT2FIX(hash);
+ return LONG2FIX((long)hash);
}
/*
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 0a7e6f15cb..eb1d385a7b 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -6405,7 +6405,7 @@ d_lite_hash(VALUE self)
h[2] = m_df(dat);
h[3] = m_sf(dat);
v = rb_memhash(h, sizeof(h));
- return LONG2FIX(v);
+ return LONG2FIX((long)v);
}
#include "date_tmx.h"
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 0af6c68466..57bb68099a 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -912,7 +912,7 @@ ossl_bn_hash(VALUE self)
ossl_raise(eBNError, NULL);
}
- hash = INT2FIX(rb_memhash(buf, len));
+ hash = LONG2FIX((long)rb_memhash(buf, len));
xfree(buf);
return hash;
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 4296b50c59..ab19b7e100 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -521,6 +521,7 @@ class TestBigDecimal < Test::Unit::TestCase
a.each_with_index do |x, i|
assert_equal(i, h[x])
end
+ assert_instance_of(String, b.hash.to_s)
end
def test_marshal
diff --git a/test/date/test_date.rb b/test/date/test_date.rb
index 3bb1f4a4c7..917ef9b774 100644
--- a/test/date/test_date.rb
+++ b/test/date/test_date.rb
@@ -129,6 +129,8 @@ class TestDate < Test::Unit::TestCase
assert_equal(3, h.size)
assert_equal(9, h[Date.new(1999,5,25)])
assert_equal(9, h[DateTime.new(1999,5,25)])
+
+ assert_instance_of(String, Date.new(1999,5,25).hash.to_s)
end
def test_freeze
diff --git a/test/openssl/test_bn.rb b/test/openssl/test_bn.rb
index 415bd74c79..662b546826 100644
--- a/test/openssl/test_bn.rb
+++ b/test/openssl/test_bn.rb
@@ -56,6 +56,25 @@ class OpenSSL::TestBN < Test::Unit::TestCase
assert_equal(bn1.hash, bn2.hash)
assert_not_equal(bn3.hash, bn1.hash)
end
+
+ def test_comparison
+ e1 = OpenSSL::BN.new(999.to_s(16), 16)
+ e3 = OpenSSL::BN.new((2**107-1).to_s(16), 16)
+ assert_equal(false, e1 == nil)
+ assert_equal(false, e1 == -999)
+ assert_equal(true, e1 == 999)
+ assert_equal(true, e1 == 999.to_bn)
+ assert_equal(false, e1.eql?(nil))
+ assert_equal(false, e1.eql?(999))
+ assert_equal(true, e1.eql?(999.to_bn))
+ assert_equal(e1.hash, 999.to_bn.hash)
+ assert_not_equal(e1.hash, e3.hash)
+ assert_equal(0, e1.cmp(999))
+ assert_equal(1, e1.cmp(-999))
+ assert_equal(0, e1.ucmp(999))
+ assert_equal(0, e1.ucmp(-999))
+ assert_instance_of(String, e1.hash.to_s)
+ end
end
end
diff --git a/version.h b/version.h
index f67d12fb44..b0961d9b95 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.3.5"
-#define RUBY_RELEASE_DATE "2017-09-09"
-#define RUBY_PATCHLEVEL 369
+#define RUBY_RELEASE_DATE "2017-09-14"
+#define RUBY_PATCHLEVEL 370
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 9
-#define RUBY_RELEASE_DAY 9
+#define RUBY_RELEASE_DAY 14
#include "ruby/version.h"