ruby-changes:30255
From: akr <ko1@a...>
Date: Thu, 1 Aug 2013 21:07:01 +0900 (JST)
Subject: [ruby-changes:30255] akr:r42307 (trunk): * bignum.c (rb_big2str1): Raise an error for too big number.
akr 2013-08-01 21:05:04 +0900 (Thu, 01 Aug 2013) New Revision: 42307 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42307 Log: * bignum.c (rb_big2str1): Raise an error for too big number. Modified files: trunk/ChangeLog trunk/bignum.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42306) +++ ChangeLog (revision 42307) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Aug 1 21:02:48 2013 Tanaka Akira <akr@f...> + + * bignum.c (rb_big2str1): Raise an error for too big number. + Thu Aug 1 20:46:29 2013 Tanaka Akira <akr@f...> * bignum.c (power_cache_get_power): Hide cached Bignum objects. Index: bignum.c =================================================================== --- bignum.c (revision 42306) +++ bignum.c (revision 42307) @@ -4366,6 +4366,10 @@ rb_big2str1(VALUE x, int base) https://github.com/ruby/ruby/blob/trunk/bignum.c#L4366 if (base < 2 || 36 < base) rb_raise(rb_eArgError, "invalid radix %d", base); + if (RBIGNUM_LEN(x) >= LONG_MAX/BITSPERDIG) { + rb_raise(rb_eRangeError, "bignum too big to convert into `string'"); + } + if (POW2_P(base)) { /* base == 2 || base == 4 || base == 8 || base == 16 || base == 32 */ return big2str_base_powerof2(x, base); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/