From 708088c5fafd469d04a1b428fc49b8b7c27607d2 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 23 Jan 2017 10:52:40 +0900 Subject: Should not make empty strings shared; fix #3407 --- src/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string.c b/src/string.c index d6bdd6975..02c7ce426 100644 --- a/src/string.c +++ b/src/string.c @@ -423,7 +423,7 @@ byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len) mrb_shared_string *shared; orig = mrb_str_ptr(str); - if (RSTR_EMBED_P(orig)) { + if (RSTR_EMBED_P(orig) || RSTR_LEN(orig) == 0) { s = str_new(mrb, orig->as.ary+beg, len); } else { -- cgit v1.2.3