[前][次][番号順一覧][スレッド一覧]

ruby-changes:11513

From: nobu <ko1@a...>
Date: Mon, 6 Apr 2009 15:12:11 +0900 (JST)
Subject: [ruby-changes:11513] Ruby:r23139 (trunk): * numeric.c (int_chr): checsk overflow.

nobu	2009-04-06 15:11:57 +0900 (Mon, 06 Apr 2009)

  New Revision: 23139

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23139

  Log:
    * numeric.c (int_chr): checsk overflow.

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23138)
+++ ChangeLog	(revision 23139)
@@ -1,3 +1,12 @@
+Mon Apr  6 15:11:56 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* numeric.c (int_chr): checsk overflow.
+
+Mon Apr  6 10:49:47 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* ext/stringio/stringio.c (strio_path): removed.  [ruby-dev:38254]
Index: numeric.c
===================================================================
--- numeric.c	(revision 23138)
+++ numeric.c	(revision 23139)
@@ -1969,7 +1969,10 @@
     }
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]