From ea2cb282aeba0457aa775d5dbfa1da6810fafa45 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 27 Apr 2007 08:05:21 +0000 Subject: [PATCH] * numeric.c (int_pow): bugfix of overflow detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 +++- numeric.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8f2f536d8..4251d89598 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ -Fri Apr 27 12:54:35 2007 Nobuyoshi Nakada +Fri Apr 27 17:05:41 2007 Nobuyoshi Nakada + + * numeric.c (int_pow): bugfix of overflow detection. * numeric.c (int_pow): rb_big_pow() may return other than Bignum. diff --git a/numeric.c b/numeric.c index 1425348a95..db847567d0 100644 --- a/numeric.c +++ b/numeric.c @@ -2283,7 +2283,7 @@ int_pow(long x, unsigned long y) } { long xz = x * z; - if (xz < z || xz < x || !POSFIXABLE(xz)) { + if (!POSFIXABLE(xz) || xz / x != z) { goto bignum; } z = xz;