summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-06 08:38:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-06 08:38:36 +0000
commit1f6a7c18f59a0547bd11a9b355376d2d6fd6e406 (patch)
treeb10e8c244ec13de3d040be68d34504ef19fdbf2a /ext
parent534388dd1795b9122a70b4722fd0e3c9f73dc569 (diff)
* ext/date/date_core.c (DAY_IN_NANOSECONDS): refix: 31438.
check with LONG_MAX and cast as long; without this the calculation will be done as int and overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/date/date_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 84338c4eff8..73d0b553478 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -42,8 +42,8 @@
#define DAY_IN_SECONDS 86400
#define SECOND_IN_NANOSECONDS 1000000000
-#if (ULONG_MAX / DAY_IN_SECONDS) > SECOND_IN_NANOSECONDS
-#define DAY_IN_NANOSECONDS LONG2NUM(DAY_IN_SECONDS * SECOND_IN_NANOSECONDS)
+#if (LONG_MAX / DAY_IN_SECONDS) > SECOND_IN_NANOSECONDS
+#define DAY_IN_NANOSECONDS LONG2NUM((long)DAY_IN_SECONDS * SECOND_IN_NANOSECONDS)
#elif defined HAVE_LONG_LONG
#define DAY_IN_NANOSECONDS LL2NUM((LONG_LONG)DAY_IN_SECONDS * SECOND_IN_NANOSECONDS)
#else