Bug #5902 » bug-5902.diff
w/array.c | ||
---|---|---|
VALUE val, tmp, result;
|
||
if (RARRAY_LEN(ary) == 0) return rb_usascii_str_new(0, 0);
|
||
if (OBJ_TAINTED(ary) || OBJ_TAINTED(sep)) taint = TRUE;
|
||
if (OBJ_UNTRUSTED(ary) || OBJ_UNTRUSTED(sep)) untrust = TRUE;
|
||
if (OBJ_TAINTED(ary)) taint = TRUE;
|
||
if (OBJ_UNTRUSTED(ary)) untrust = TRUE;
|
||
if (!NIL_P(sep)) {
|
||
StringValue(sep);
|
w/test/ruby/test_array.rb | ||
---|---|---|
assert_equal(true, s.tainted?)
|
||
assert_equal(true, s.untrusted?)
|
||
bug5902 = '[ruby-core:42161]'
|
||
sep = ":".taint.untrust
|
||
s = @cls[].join(sep)
|
||
assert_equal(false, s.tainted?, bug5902)
|
||
assert_equal(false, s.untrusted?, bug5902)
|
||
s = @cls[1].join(sep)
|
||
assert_equal(false, s.tainted?, bug5902)
|
||
assert_equal(false, s.untrusted?, bug5902)
|
||
s = @cls[1, 2].join(sep)
|
||
assert_equal(true, s.tainted?, bug5902)
|
||
assert_equal(true, s.untrusted?, bug5902)
|
||
e = ''.force_encoding('EUC-JP')
|
||
u = ''.force_encoding('UTF-8')
|
||
assert_equal(Encoding::US_ASCII, [[]].join.encoding)
|