summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--numeric.c8
-rw-r--r--version.h6
3 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index cc4b896c5a..b08618c2be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Jul 14 01:44:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * numeric.c (int_pow): wrong overflow detection. [ruby-dev:31213]
+
Fri Jul 13 16:10:00 2007 Tanaka Akira <akr@fsij.org>
* lib/open-uri.rb (URI::Generic#find_proxy): use ENV.to_hash to access
diff --git a/numeric.c b/numeric.c
index f0b827aacc..c4210279a4 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2197,16 +2197,18 @@ int_pow(x, y)
while (y % 2 == 0) {
long x2 = x * x;
if (x2 < x || !POSFIXABLE(x2)) {
+ VALUE v;
bignum:
- return rb_big_mul(rb_big_pow(rb_int2big(x), LONG2NUM(y)),
- rb_int2big(neg ? -z : z));
+ v = rb_big_pow(rb_int2big(x), LONG2NUM(y));
+ if (z != 1) v = rb_big_mul(rb_int2big(neg ? -z : z), v);
+ return v;
}
x = x2;
y >>= 1;
}
{
long xz = x * z;
- if (xz < z || xz < x || !POSFIXABLE(xz)) {
+ if (!POSFIXABLE(xz) || xz / x != z) {
goto bignum;
}
z = xz;
diff --git a/version.h b/version.h
index 237e054fd2..ee770d10d8 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.6"
-#define RUBY_RELEASE_DATE "2007-07-13"
+#define RUBY_RELEASE_DATE "2007-07-14"
#define RUBY_VERSION_CODE 186
-#define RUBY_RELEASE_CODE 20070713
+#define RUBY_RELEASE_CODE 20070714
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 13
+#define RUBY_RELEASE_DAY 14
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];