From: takuma ozawa Date: 2002-01-10T07:27:37+09:00 Subject: [ruby-dev:15667] propagation of taint by MatchData#select 小澤といいます。 MatchData#selectで汚染が伝播しません。 ruby 1.7.2 (2002-01-08) [i386-mingw32] で確認しました。 m = 'aaa'.taint.match('aaa') a = m.select(0) a.each { |e| p e.tainted? } #=> false --- re.c.orig Sat Jan 05 04:51:26 2002 +++ re.c Thu Jan 10 07:15:44 2002 @@ -829,6 +829,7 @@ VALUE result = rb_ary_new(); int i; long idx; + int taint = OBJ_TAINTED(match); for (i=0; ibeg[idx], - regs->end[idx]-regs->beg[idx])); + VALUE str = rb_str_new(ptr+regs->beg[i], regs->end[i]-regs->beg[i]); + if (taint) OBJ_TAINT(str); + rb_ary_push(result, str); } } return result;