Skip to content

Commit 60ee9cc

Browse files
jeremyevansnobu
authored andcommitted
Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions.
1 parent 68e9b32 commit 60ee9cc

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

ext/stringio/stringio.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,6 @@ strio_copy(VALUE copy, VALUE orig)
623623
strio_free(DATA_PTR(copy));
624624
}
625625
DATA_PTR(copy) = ptr;
626-
OBJ_INFECT(copy, orig);
627626
RBASIC(copy)->flags &= ~STRIO_READWRITE;
628627
RBASIC(copy)->flags |= RBASIC(orig)->flags & STRIO_READWRITE;
629628
++ptr->count;
@@ -1436,7 +1435,6 @@ strio_write(VALUE self, VALUE str)
14361435
if (ptr->pos == olen) {
14371436
if (enc == ascii8bit || enc2 == ascii8bit) {
14381437
rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc);
1439-
OBJ_INFECT(ptr->string, str);
14401438
}
14411439
else {
14421440
rb_str_buf_append(ptr->string, str);
@@ -1445,9 +1443,7 @@ strio_write(VALUE self, VALUE str)
14451443
else {
14461444
strio_extend(ptr, ptr->pos, len);
14471445
memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len);
1448-
OBJ_INFECT(ptr->string, str);
14491446
}
1450-
OBJ_INFECT(ptr->string, self);
14511447
RB_GC_GUARD(str);
14521448
ptr->pos += len;
14531449
return len;

test/stringio/test_stringio.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,6 @@ def o.to_s; "baz"; end
180180
f.close unless f.closed?
181181
end
182182

183-
def test_write_infection
184-
bug9769 = '[ruby-dev:48118] [Bug #9769]'
185-
s = "".untaint
186-
f = StringIO.new(s, "w")
187-
f.print("bar".taint)
188-
f.close
189-
assert_predicate(s, :tainted?, bug9769)
190-
ensure
191-
f.close unless f.closed?
192-
end
193-
194183
def test_write_encoding
195184
s = "".force_encoding(Encoding::UTF_8)
196185
f = StringIO.new(s)

0 commit comments

Comments
 (0)