mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 15645:15647:
* bignum.c (big2str_find_n1): check integer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4d7f100976
commit
11b262e44c
4 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Sun Jun 15 19:54:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (big2str_find_n1): check integer overflow.
|
||||
|
||||
Sun Jun 15 19:52:20 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* gc.c (STACK_LENGTH) [SPARC] : 0x80 offset removed. [ruby-dev:33857]
|
||||
|
|
3
bignum.c
3
bignum.c
|
@ -652,6 +652,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;
|
||||
|
|
|
@ -84,4 +84,12 @@ class TestBignum < Test::Unit::TestCase
|
|||
shift_test(-4518325415524767873)
|
||||
shift_test(-0xfffffffffffffffff)
|
||||
end
|
||||
|
||||
def test_too_big_to_s
|
||||
if (big = 2**31-1).is_a?(Fixnum)
|
||||
return
|
||||
end
|
||||
e = assert_raise(RangeError) {(1 << big).to_s}
|
||||
assert_match(/too big to convert/, e.message)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define RUBY_RELEASE_DATE "2008-06-15"
|
||||
#define RUBY_VERSION_CODE 186
|
||||
#define RUBY_RELEASE_CODE 20080615
|
||||
#define RUBY_PATCHLEVEL 183
|
||||
#define RUBY_PATCHLEVEL 184
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue