summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-25 13:10:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-25 13:10:14 +0000
commit9237049efe48ce61219aeacf855da90e6e7602fb (patch)
treed4cc93322e32c7c4d3b5c9bceeb5361be9ca8d9c /string.c
parent845b3cfbf486f037e93ef520e344c3451e9559fc (diff)
string.c: clear substring code range
* string.c (str_substr): substring of broken code range string may be valid or broken. patch by tommy (Masahiro Tomita) at [ruby-dev:50430] [Bug #14388]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index 82fa603ada..9079387fac 100644
--- a/string.c
+++ b/string.c
@@ -2560,6 +2560,7 @@ str_substr(VALUE str, long beg, long len, int empty)
str2 = str_new_shared(rb_obj_class(str2), str2);
RSTRING(str2)->as.heap.ptr += ofs;
RSTRING(str2)->as.heap.len = len;
+ ENC_CODERANGE_CLEAR(str2);
}
else {
if (!len && !empty) return Qnil;