summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-02-11 16:27:07 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-02-11 16:27:07 +0900
commit8f4a929e1a01c8d6176fb53a9ef5dff6de632959 (patch)
treea537967ba69bcb3c1447480ef7ccba28ac3132b1 /src/string.c
parent6cb7aef56318a345fd7dd9afa3c25e33eb7dd03e (diff)
downloadmruby-8f4a929e1a01c8d6176fb53a9ef5dff6de632959.tar.gz
mruby-8f4a929e1a01c8d6176fb53a9ef5dff6de632959.zip
String#replace should update s->flags for MRB_STR_NO_UTF.
Otherwise String#size may return wrong length; fix #3448
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index 5e37abee1..abe8ad865 100644
--- a/src/string.c
+++ b/src/string.c
@@ -519,6 +519,8 @@ str_replace(mrb_state *mrb, struct RString *s1, struct RString *s2)
long len;
check_frozen(mrb, s1);
+ s1->flags &= ~MRB_STR_NO_UTF;
+ s1->flags |= s2->flags&MRB_STR_NO_UTF;
if (s1 == s2) return mrb_obj_value(s1);
len = RSTR_LEN(s2);
if (RSTR_SHARED_P(s1)) {