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

ruby-changes:53739

From: naruse <ko1@a...>
Date: Sat, 24 Nov 2018 21:26:12 +0900 (JST)
Subject: [ruby-changes:53739] naruse:r65956 (trunk): fix r65954; Keep tainty

naruse	2018-11-24 21:26:07 +0900 (Sat, 24 Nov 2018)

  New Revision: 65956

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65956

  Log:
    fix r65954; Keep tainty

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 65955)
+++ string.c	(revision 65956)
@@ -8485,7 +8485,7 @@ rb_str_enumerate_grapheme_clusters(VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L8485
     VALUE orig = str;
     regex_t *reg_grapheme_cluster = NULL;
     rb_encoding *enc = rb_enc_from_index(ENCODING_GET(str));
-    const char *ptr, *end;
+    const char *ptr0, *ptr, *end;
 
     if (!rb_enc_unicode_p(enc)) {
 	return rb_str_enumerate_chars(str, ary);
@@ -8493,7 +8493,7 @@ rb_str_enumerate_grapheme_clusters(VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L8493
 
     if (!ary) str = rb_str_new_frozen(str);
     reg_grapheme_cluster = get_reg_grapheme_cluster(enc);
-    ptr = RSTRING_PTR(str);
+    ptr0 = ptr = RSTRING_PTR(str);
     end = RSTRING_END(str);
 
     while (ptr < end) {
@@ -8501,7 +8501,7 @@ rb_str_enumerate_grapheme_clusters(VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L8501
 				      (const OnigUChar *)ptr, (const OnigUChar *)end,
 				      (const OnigUChar *)ptr, NULL, 0);
 	if (len <= 0) break;
-	ENUM_ELEM(ary, rb_enc_str_new(ptr, len, enc));
+	ENUM_ELEM(ary, rb_str_subseq(str, ptr-ptr0, len));
 	ptr += len;
     }
     RB_GC_GUARD(str);

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

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