* numeric.c (int_chr): checsk overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
090dc8fd54
commit
1b71f8a53b
@ -1,3 +1,12 @@
|
|||||||
|
Mon Apr 6 15:11:56 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* numeric.c (int_chr): checsk overflow.
|
||||||
|
|
||||||
|
Mon Apr 6 10:49:47 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/stringio/test_stringio.rb (test_path): StringIO#path is no
|
||||||
|
longer defined. [ruby-dev:38254]
|
||||||
|
|
||||||
Mon Apr 6 10:47:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Apr 6 10:47:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/stringio/stringio.c (strio_path): removed. [ruby-dev:38254]
|
* ext/stringio/stringio.c (strio_path): removed. [ruby-dev:38254]
|
||||||
|
@ -1969,7 +1969,10 @@ int_chr(int argc, VALUE *argv, VALUE num)
|
|||||||
}
|
}
|
||||||
enc = rb_to_encoding(argv[0]);
|
enc = rb_to_encoding(argv[0]);
|
||||||
if (!enc) enc = rb_ascii8bit_encoding();
|
if (!enc) enc = rb_ascii8bit_encoding();
|
||||||
if (i < 0 || (n = rb_enc_codelen(i, enc)) <= 0) goto out_of_range;
|
#if SIZEOF_INT < SIZEOF_LONG
|
||||||
|
if (i > INT_MAX) goto out_of_range;
|
||||||
|
#endif
|
||||||
|
if (i < 0 || (n = rb_enc_codelen((int)i, enc)) <= 0) goto out_of_range;
|
||||||
str = rb_enc_str_new(0, n, enc);
|
str = rb_enc_str_new(0, n, enc);
|
||||||
rb_enc_mbcput(i, RSTRING_PTR(str), enc);
|
rb_enc_mbcput(i, RSTRING_PTR(str), enc);
|
||||||
return str;
|
return str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user