diff --git a/pack.c b/pack.c index 1eceee0af6..05a5f76dc5 100644 --- a/pack.c +++ b/pack.c @@ -751,6 +751,7 @@ pack_pack(VALUE ary, VALUE fmt) StringValue(from); ptr = RSTRING_PTR(from); plen = RSTRING_LEN(from); + OBJ_INFECT(res, from); if (len == 0 && type == 'm') { encodes(res, ptr, plen, type, 0); @@ -778,6 +779,7 @@ pack_pack(VALUE ary, VALUE fmt) case 'M': /* quoted-printable encoded string */ from = rb_obj_as_string(NEXTFROM); + OBJ_INFECT(res, from); if (len <= 1) len = 72; qpencode(res, from, len); @@ -803,6 +805,7 @@ pack_pack(VALUE ary, VALUE fmt) } else { t = StringValuePtr(from); + OBJ_INFECT(res, from); rb_obj_taint(from); } if (!associates) { @@ -1292,6 +1295,7 @@ pack_unpack(VALUE str, VALUE fmt) len = (send - s) * 8; bits = 0; bitstr = rb_usascii_str_new(0, len); + OBJ_INFECT(bitstr, str); t = RSTRING_PTR(bitstr); for (i=0; i>= 1; @@ -1313,6 +1317,7 @@ pack_unpack(VALUE str, VALUE fmt) len = (send - s) * 8; bits = 0; bitstr = rb_usascii_str_new(0, len); + OBJ_INFECT(bitstr, str); t = RSTRING_PTR(bitstr); for (i=0; i