summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-17 04:35:26 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-17 04:35:26 (GMT)
commiteec8adb168b7a778ed1c087c93e73e470fd4ec64 (patch)
tree38821172577903d9d534bba5af79aeeb55461880 /transcode.c
parente64d814101fc0ee5c856ef55282c1efd6db3681c (diff)
transcode.c: infection
* transcode.c (rb_econv_substr_append, econv_primitive_convert): the result should be infected by the original string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/transcode.c b/transcode.c
index 1977498..c2032a8 100644
--- a/transcode.c
+++ b/transcode.c
@@ -1854,6 +1854,7 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst,
src = rb_str_new_frozen(src);
dst = rb_econv_append(ec, RSTRING_PTR(src) + off, len, dst, flags);
RB_GC_GUARD(src);
+ OBJ_INFECT_RAW(dst, src);
return dst;
}
@@ -3768,8 +3769,10 @@ econv_primitive_convert(int argc, VALUE *argv, VALUE self)
res = rb_econv_convert(ec, &ip, is, &op, os, flags);
rb_str_set_len(output, op-(unsigned char *)RSTRING_PTR(output));
- if (!NIL_P(input))
+ if (!NIL_P(input)) {
+ OBJ_INFECT_RAW(output, input);
rb_str_drop_bytes(input, ip - (unsigned char *)RSTRING_PTR(input));
+ }
if (NIL_P(output_bytesize_v) && res == econv_destination_buffer_full) {
if (LONG_MAX / 2 < output_bytesize)