Skip to content
Permalink
Browse files
String#replace should update s->flags for MRB_STR_NO_UTF.
Otherwise String#size may return wrong length; fix #3448
  • Loading branch information
matz committed Feb 11, 2017
1 parent 6cb7aef commit 8f4a929e1a01c8d6176fb53a9ef5dff6de632959
Showing 1 changed file with 2 additions and 0 deletions.
@@ -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)) {

0 comments on commit 8f4a929

Please sign in to comment.