[#15625] rb_hash_initialize — Takaaki Tateishi <ttate@...>

立石です.

22 messages 2002/01/04
[#15627] Re: rb_hash_initialize — matz@... (Yukihiro Matsumoto) 2002/01/04

まつもと ゆきひろです

[#15628] Re: rb_hash_initialize — Takaaki Tateishi <ttate@...> 2002/01/04

立石です.

[#15685] undefined method `inherited' for false (NameError) — WATANABE Hirofumi <eban@...>

わたなべです。

13 messages 2002/01/15
[#15686] Re: undefined method `inherited' for false (NameError) — nobu.nakada@... 2002/01/15

なかだです。

[#15757] 文字列→整数変換 — nobu.nakada@...

なかだです。

30 messages 2002/01/25

[#15830] [ 提案 ] puts, print 等を IO から分離 — UENO Katsuhiro <unnie@...>

うえのです。

14 messages 2002/01/31

[ruby-dev:15667] propagation of taint by MatchData#select

From: takuma ozawa <metal@...>
Date: 2002-01-09 22:27:37 UTC
List: ruby-dev #15667
小澤といいます。

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; i<argc; i++) {
 	idx = NUM2LONG(argv[i]);
@@ -837,8 +838,9 @@
 	    rb_ary_push(result, Qnil);
 	}
 	else {
-	    rb_ary_push(result, rb_str_new(ptr+regs->beg[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;

In This Thread

Prev Next