diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-29 17:35:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-29 17:35:11 +0000 |
commit | e811e5e4729b46b1c5522977437e25901852580f (patch) | |
tree | 4f53ac4cb3bcb9823a7c93f030309f2e888b8967 /bignum.c | |
parent | f8f371c011d9b671f5061b2a36fe111b73c53ed6 (diff) |
* bignum.c (big2str_find_n1): check integer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -676,6 +676,9 @@ rb_big2str0(x, base, trim) 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; |