From 4a65cba488e02f00a66d430aee24a9e1bcc04cb7 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 29 Feb 2008 17:35:11 +0000 Subject: * 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 --- test/ruby/test_bignum.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb index 2d9008ecce..be33e2f5af 100644 --- a/test/ruby/test_bignum.rb +++ b/test/ruby/test_bignum.rb @@ -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 -- cgit v1.2.3