summaryrefslogtreecommitdiff
path: root/ext
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 /ext
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
Diffstat (limited to 'ext')
-rw-r--r--ext/date/date_core.c10
1 files changed, 8 insertions, 2 deletions
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;
}