1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c (big2str_find_n1): check integer overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-02-29 17:35:11 +00:00
parent cd89edc065
commit 4a65cba488
3 changed files with 16 additions and 0 deletions

View file

@ -377,4 +377,13 @@ class TestBignum < Test::Unit::TestCase
def test_interrupt
assert(interrupt { (65536 ** 65536).to_s })
end
def test_too_big_to_s
i = 32
while (big = 2**(i-1)-1).is_a?(Fixnum)
i *= 2
end
e = assert_raise(RangeError) {(1 << big).to_s}
assert_match(/too big to convert/, e.message)
end
end