summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 10:54:01 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 10:54:01 +0000
commitc71b916f37c5dc0c0202b4410af2c3dc1c740bb9 (patch)
tree98c38f4178c5e3badce86f6bb073479d9889de51 /bignum.c
parent6d2a37a0e74ade72c0750c5c8446a654469b2db1 (diff)
merge revision(s) 15645:15647:
* bignum.c (big2str_find_n1): check integer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bignum.c b/bignum.c
index cf7649c47e..80ab1c936b 100644
--- a/bignum.c
+++ b/bignum.c
@@ -636,6 +636,9 @@ rb_big2str(x, base)
if (BIGZEROP(x)) {
return rb_str_new2("0");
}
+ if (i >= LONG_MAX/SIZEOF_BDIGITS/CHAR_BIT) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
j = SIZEOF_BDIGITS*CHAR_BIT*i;
switch (base) {
case 2: break;