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

ruby-changes:7381

From: mame <ko1@a...>
Date: Thu, 28 Aug 2008 23:41:08 +0900 (JST)
Subject: [ruby-changes:7381] Ruby:r18900 (trunk): * string.c (rb_str_shared_replace): remove corrupt noembed string

mame	2008-08-28 23:40:53 +0900 (Thu, 28 Aug 2008)

  New Revision: 18900

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

  Log:
    * string.c (rb_str_shared_replace): remove corrupt noembed string
      which causes SEGV.  [ruby-dev:35989]

  Modified files:
    trunk/ChangeLog
    trunk/string.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18899)
+++ ChangeLog	(revision 18900)
@@ -1,3 +1,8 @@
+Thu Aug 28 23:39:49 2008  Yusuke Endoh  <mame@t...>
+
+	* string.c (rb_str_shared_replace): remove corrupt noembed string
+	  which causes SEGV.  [ruby-dev:35989]
+
 Thu Aug 28 23:36:15 2008  Tanaka Akira  <akr@f...>
 
 	* common.mk: dependency updated.
Index: string.c
===================================================================
--- string.c	(revision 18899)
+++ string.c	(revision 18900)
@@ -669,10 +669,9 @@
     else {
 	RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa;
     }
-    RSTRING(str2)->as.heap.ptr = 0;	/* abandon str2 */
-    RSTRING(str2)->as.heap.len = 0;
-    RSTRING(str2)->as.heap.aux.capa = 0;
-    STR_UNSET_NOCAPA(str2);
+    STR_SET_EMBED(str2);	/* abandon str2 */
+    RSTRING_PTR(str2)[0] = 0;
+    STR_SET_EMBED_LEN(str2, 0);
     rb_enc_associate(str, enc);
     ENC_CODERANGE_SET(str, cr);
 }

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

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