aboutsummaryrefslogtreecommitdiffstats
path: root/ext/date/date_core.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-01 20:56:50 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-01 20:56:50 +0000
commitbd52bed97be25e8f3344033ac01416349ec8be67 (patch)
treec5c4f0a5dde4d00d9878819587c70dd0c3eb65ea /ext/date/date_core.c
parentc8cde4e2be5a1cdc151e436d6d2189314902d748 (diff)
downloadruby-bd52bed97be25e8f3344033ac01416349ec8be67.tar.gz
* ext/date/date_core.c: [ruby-core:46058].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date/date_core.c')
-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 8096fd7bfb..e44c6474c4 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -980,8 +980,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;
}