diff options
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r-- | ext/date/date_core.c | 10 |
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; } |