diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-01-23 10:52:40 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-01-23 10:52:40 +0900 |
| commit | 708088c5fafd469d04a1b428fc49b8b7c27607d2 (patch) | |
| tree | cbfea308532747505533275b09d1fa74ea4de491 | |
| parent | 49fd7590df4f510c611f31652235887c0aaaa962 (diff) | |
| download | mruby-708088c5fafd469d04a1b428fc49b8b7c27607d2.tar.gz mruby-708088c5fafd469d04a1b428fc49b8b7c27607d2.zip | |
Should not make empty strings shared; fix #3407
| -rw-r--r-- | src/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 { |
