Skip to content

Commit c204c6b

Browse files
committed
* 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
1 parent f25a57b commit c204c6b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Wed Aug 22 10:29:45 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* bignum.c (rb_big_pow): refine overflow check. [ruby-dev:31242]
4+
15
Wed Aug 22 10:26:59 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
26

37
* time.c (time_succ): Time#succ should return a time object in the

bignum.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1646,8 +1646,10 @@ rb_big_pow(x, y)
16461646
yy = FIX2LONG(y);
16471647
if (yy > 0) {
16481648
VALUE z = x;
1649+
const long BIGLEN_LIMIT = 1024*1024 / SIZEOF_BDIGITS;
16491650

1650-
if (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) {
1651+
if ((RBIGNUM(x)->len > BIGLEN_LIMIT) ||
1652+
(RBIGNUM(x)->len > BIGLEN_LIMIT / yy)) {
16511653
rb_warn("in a**b, b may be too big");
16521654
d = (double)yy;
16531655
break;

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2007-08-22"
33
#define RUBY_VERSION_CODE 186
44
#define RUBY_RELEASE_CODE 20070822
5-
#define RUBY_PATCHLEVEL 69
5+
#define RUBY_PATCHLEVEL 70
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)