diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-22 01:32:19 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-22 01:32:19 +0000 |
commit | c204c6b71bad7db3b95484f519f89da26ce7bc02 (patch) | |
tree | ab60aaa1f8788130bc13fe5460d00ab446439f50 | |
parent | f25a57b3ef00ac4aff728615aca6764e89163099 (diff) |
* bignum.c (rb_big_pow): refine overflow check. [ruby-dev:31242]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@13186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | bignum.c | 4 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Wed Aug 22 10:29:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * bignum.c (rb_big_pow): refine overflow check. [ruby-dev:31242] + Wed Aug 22 10:26:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org> * time.c (time_succ): Time#succ should return a time object in the @@ -1646,8 +1646,10 @@ rb_big_pow(x, y) yy = FIX2LONG(y); if (yy > 0) { VALUE z = x; + const long BIGLEN_LIMIT = 1024*1024 / SIZEOF_BDIGITS; - if (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) { + if ((RBIGNUM(x)->len > BIGLEN_LIMIT) || + (RBIGNUM(x)->len > BIGLEN_LIMIT / yy)) { rb_warn("in a**b, b may be too big"); d = (double)yy; break; @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2007-08-22" #define RUBY_VERSION_CODE 186 #define RUBY_RELEASE_CODE 20070822 -#define RUBY_PATCHLEVEL 69 +#define RUBY_PATCHLEVEL 70 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 |