aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-28 04:59:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-28 04:59:49 +0000
commita4a551f85658c90de5723b9d0f7e06c87a0e6378 (patch)
tree1dee13eb1ccd7b568b112527b6181f00ef49b680 /numeric.c
parentd596ba8dc032335fd89491951297802c3aeb66a1 (diff)
downloadruby-a4a551f85658c90de5723b9d0f7e06c87a0e6378.tar.gz
numeric.c: integer overflow
* numeric.c (ruby_num_interval_step_size): get rid of integer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 14ebc3b1c6..9692be96ce 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1830,7 +1830,7 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
if (delta < 0) {
return INT2FIX(0);
}
- return LONG2FIX(delta / diff + 1);
+ return ULONG2NUM(delta / diff + 1UL);
}
else if (RB_TYPE_P(from, T_FLOAT) || RB_TYPE_P(to, T_FLOAT) || RB_TYPE_P(step, T_FLOAT)) {
double n = ruby_float_step_size(NUM2DBL(from), NUM2DBL(to), NUM2DBL(step), excl);