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

ruby-changes:3399

From: ko1@a...
Date: 5 Jan 2008 14:45:53 +0900
Subject: [ruby-changes:3399] nobu - Ruby:r14892 (trunk): * string.c (rb_str_resize): copy at old length but not new length.

nobu	2008-01-05 14:45:40 +0900 (Sat, 05 Jan 2008)

  New Revision: 14892

  Modified files:
    trunk/ChangeLog
    trunk/string.c

  Log:
    * string.c (rb_str_resize): copy at old length but not new length.
      [ruby-core:14785]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14892&r2=14891&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14892&r2=14891&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14891)
+++ ChangeLog	(revision 14892)
@@ -1,3 +1,8 @@
+Sat Jan  5 14:45:38 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (rb_str_resize): copy at old length but not new length.
+	  [ruby-core:14785]
+
 Sat Jan  5 13:04:24 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby.c (proc_options): no need for intermediate object.
Index: string.c
===================================================================
--- string.c	(revision 14891)
+++ string.c	(revision 14892)
@@ -948,7 +948,7 @@
 	else if (len <= RSTRING_EMBED_LEN_MAX) {
 	    char *ptr = RSTRING(str)->as.heap.ptr;
 	    STR_SET_EMBED(str);
-	    MEMCPY(RSTRING(str)->as.ary, ptr, char, len);
+	    if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen);
 	    RSTRING(str)->as.ary[len] = '\0';
 	    STR_SET_EMBED_LEN(str, len);
 	    xfree(ptr);

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

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