From 1f9731654e4d2d04fa0020b6a2265e8e25d1e0c7 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 24 Nov 2018 12:26:07 +0000 Subject: fix r65954; Keep tainty git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 26d03d1835..17f0b08f11 100644 --- a/string.c +++ b/string.c @@ -8485,7 +8485,7 @@ rb_str_enumerate_grapheme_clusters(VALUE str, VALUE ary) 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 str, VALUE ary) 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 str, VALUE ary) (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); -- cgit v1.2.3