summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-11 12:51:59 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-11 12:51:59 +0000
commitd704a0fe3fafe1028fe57618d19a6de35b08cbf9 (patch)
tree88134fd0f5dd51e007df44047ddf1e159866f411 /numeric.c
parentbdd97e5f38d6ef876a1ed1206f0d7ba3e7da9983 (diff)
merge revision(s) 67203: [Backport #15651]
numeric.c: fix infinite loop * numeric.c (int_pow): fix infinite loop in the case of y equal 1 and power of x does not overflow. [ruby-core:91734] [Bug #15651] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index 1589271d0a..dc5e4e7d3e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -3905,6 +3905,7 @@ int_pow(long x, unsigned long y)
long z = 1;
if (y == 0) return INT2FIX(1);
+ if (y == 1) return LONG2NUM(x);
if (neg) x = -x;
if (y & 1)
z = x;