summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-17 02:01:42 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-17 02:01:42 +0000
commit297ac0a672480e19ab666f81e47ee097f1d60a29 (patch)
tree54ee2218f8e883092ea6e839c5e0f7d33cfc71c6
parentce8c46b48dc37fdcef0e5d677e7d6b52257a377b (diff)
merge revision(s) 36265: [Backport #8580]
* ext/date/date_core.c: [ruby-core:46058]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@42017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--ext/date/date_core.c10
-rw-r--r--test/date/test_switch_hitter.rb2
-rw-r--r--version.h2
4 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 14138844e7..cb86c707d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jul 17 11:00:21 2013 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:46058].
+
Wed Jul 17 10:14:37 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
* lib/openssl/ssl-internal.rb: Fix SSL client connection crash for SAN
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 634fe2f9d0..307cc47c59 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -991,8 +991,14 @@ safe_mul_p(VALUE x, long m)
if (!FIXNUM_P(x))
return 0;
ix = FIX2LONG(x);
- if (ix >= (FIXNUM_MAX / m))
- return 0;
+ if (ix < 0) {
+ if (ix <= (FIXNUM_MIN / m))
+ return 0;
+ }
+ else {
+ if (ix >= (FIXNUM_MAX / m))
+ return 0;
+ }
return 1;
}
diff --git a/test/date/test_switch_hitter.rb b/test/date/test_switch_hitter.rb
index be3346fd5a..2a36792f56 100644
--- a/test/date/test_switch_hitter.rb
+++ b/test/date/test_switch_hitter.rb
@@ -294,6 +294,8 @@ class TestSH < Test::Unit::TestCase
assert_raise(Errno::ERANGE) do
Date.new(1 << 10000).strftime('%Y')
end
+ assert_equal('-3786825600', Date.new(1850).strftime('%s'))
+ assert_equal('-3786825600000', Date.new(1850).strftime('%Q'))
end
def test_cmp
diff --git a/version.h b/version.h
index 5e77e768a7..493b718196 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 454
+#define RUBY_PATCHLEVEL 455
#define RUBY_RELEASE_DATE "2013-07-17"
#define RUBY_RELEASE_YEAR 2013