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 | d45010b150b552c81b00ba62d69148bbba8b5a92 (patch) | |
tree | 92c8d777e3aeff6624fa7a4b01da74899470720f /bignum.c | |
parent | 2d0fc0ac04304a0a5c3ff232bedd053106cab93c (diff) | |
download | ruby-d45010b150b552c81b00ba62d69148bbba8b5a92.tar.gz ruby-d45010b150b552c81b00ba62d69148bbba8b5a92.tar.xz ruby-d45010b150b552c81b00ba62d69148bbba8b5a92.zip |
* bignum.c (big2str_find_n1): check integer overflow.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -829,6 +829,9 @@ big2str_find_n1(VALUE x, int base) else if (BIGZEROP(x)) { return 0; } + else if (RBIGNUM_LEN(x) >= LONG_MAX/BITSPERDIG) { + rb_raise(rb_eRangeError, "bignum too big to convert into `string'"); + } else { bits = BITSPERDIG*RBIGNUM_LEN(x); } |