[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01185] Re: removing tainting

From: matz@... (Yukihiro Matsumoto)
Date: 2000-01-25 17:01:52 UTC
List: ruby-talk #1185
In message "[ruby-talk:01183] removing tainting"
    on 00/01/25, Dave Thomas <Dave@thomases.com> writes:

|Should the following sequence remove tainting?
|
|   s = "hello".taint
|   t = s.to_a[0]
|   p s.tainted?
|   p t.tainted?

Oops, it's a bug.
String#each_line should propagate tainting.

--- string.c~	Mon Jan 17 17:24:12 2000
+++ string.c	Wed Jan 26 01:53:49 2000
@@ -2190,6 +2209,7 @@
     if (s != pend) {
         if (p > pend) p = pend;
 	line = rb_str_new(s, p - s);
+	OBJ_INFECT(line, str);
 	rb_yield(line);
     }
 

In This Thread

Prev Next