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

ruby-changes:18118

From: yugui <ko1@a...>
Date: Wed, 8 Dec 2010 17:27:31 +0900 (JST)
Subject: [ruby-changes:18118] Ruby:r30136 (ruby_1_9_2): * string.c (rb_str_concat): partially reverts r30040 because

yugui	2010-12-08 17:09:28 +0900 (Wed, 08 Dec 2010)

  New Revision: 30136

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

  Log:
    * string.c (rb_str_concat): partially reverts r30040 because
      it unpexpectedly changed the behavior of String#<<.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/string.c
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 30135)
+++ ruby_1_9_2/ChangeLog	(revision 30136)
@@ -1,3 +1,8 @@
+Mon Dec  6 22:28:41 2010  Yuki Sonoda (Yugui)  <yugui@y...>
+
+	* string.c (rb_str_concat): partially reverts r30040 because
+	  it unpexpectedly changes the behavior of String#<<.
+
 Fri Nov  5 00:14:15 2010  Aaron Patterson <aaron@t...>
 
 	* ext/fiddle/extconf.rb: fixing ffi library location on windows.
Index: ruby_1_9_2/string.c
===================================================================
--- ruby_1_9_2/string.c	(revision 30135)
+++ ruby_1_9_2/string.c	(revision 30136)
@@ -1998,14 +1998,23 @@
     unsigned int lc;
 
     if (FIXNUM_P(str2)) {
+	if ((int)str2 < 0)
+	    rb_raise(rb_eRangeError, "negative argument");
 	lc = FIX2UINT(str2);
     }
     else if (TYPE(str2) == T_BIGNUM) {
+	if (!RBIGNUM_SIGN(str2))
+	    rb_raise(rb_eRangeError, "negative argument");
 	lc = NUM2UINT(str2);
     }
     else {
 	return rb_str_append(str1, str2);
     }
+#if SIZEOF_INT < SIZEOF_VALUE
+    if ((VALUE)lc > UINT_MAX) {
+	rb_raise(rb_eRangeError, "%"PRIuVALUE" out of char range", lc);
+    }
+#endif
     {
 	rb_encoding *enc = STR_ENC_GET(str1);
 	long pos = RSTRING_LEN(str1);
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 30135)
+++ ruby_1_9_2/version.h	(revision 30136)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 90
+#define RUBY_PATCHLEVEL 91
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1

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

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