summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-14 17:25:57 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-14 17:25:57 +0000
commit5ad41fa169a4fa910880abe0a303e2cc628d89ba (patch)
tree990e5b64b7262a88363a4b11d8b02a0cd355a818 /transcode.c
parent145ee4b44605266f61eb190a3a6e41cfea9cff73 (diff)
merge revision(s) 49096,51353,53168,53169: [Backport #11834]
test_m17n.rb: split test_scrub * test/ruby/test_m17n.rb (TestM17N#test_scrub): split into some tests. * include/ruby/ruby.h: add raw FL macros, which assume always the argument object is not a special constant. * internal.h (STR_EMBED_P, STR_SHARED_P): valid only for T_STRING. * string.c: deal with taint flags directly across String instances. * transcode.c (rb_econv_substr_append, econv_primitive_convert): the result should be infected by the original string. * string.c (rb_str_scrub): the result should be infected by the original string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@53825 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 d5add7b6e7..cba357b884 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)