summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-06 06:11:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-06 06:11:57 +0000
commit1d6d10f3cfc6f89341d107bd469fc9257a740caf (patch)
treed445c35fe6829fe6ff24ba017b7147c5807516ab
parent87a96d59b05150479c5c63204078cabbc37df55d (diff)
downloadruby-1d6d10f3cfc6f89341d107bd469fc9257a740caf.tar.gz
ruby-1d6d10f3cfc6f89341d107bd469fc9257a740caf.tar.xz
ruby-1d6d10f3cfc6f89341d107bd469fc9257a740caf.zip
* numeric.c (int_chr): checsk overflow.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--numeric.c5
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 832e702a0..69a3e408b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* ext/stringio/stringio.c (strio_path): removed. [ruby-dev:38254]
diff --git a/numeric.c b/numeric.c
index f86ff1a12..4816140d9 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1969,7 +1969,10 @@ int_chr(int argc, VALUE *argv, VALUE num)
}
enc = rb_to_encoding(argv[0]);
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);
rb_enc_mbcput(i, RSTRING_PTR(str), enc);
return str;