[macruby-changes] [5175] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Sun Jan 16 16:12:32 PST 2011


Revision: 5175
          http://trac.macosforge.org/projects/ruby/changeset/5175
Author:   watson1978 at gmail.com
Date:     2011-01-16 16:12:27 -0800 (Sun, 16 Jan 2011)
Log Message:
-----------
String#scan will return Array which tainted each element when #scan returns Nested Arrays.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

str = "foobar"
str.taint
ary = str.scan(/(.)/)
assert_equal(false, ary.tainted?)
assert_equal(false, ary[0].tainted?)
assert_equal(true, ary[0][0].tainted?)

puts :ok
}}}

Modified Paths:
--------------
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2011-01-16 08:05:45 UTC (rev 5174)
+++ MacRuby/trunk/string.c	2011-01-17 00:12:27 UTC (rev 5175)
@@ -3076,7 +3076,7 @@
 		VALUE substr = rb_reg_nth_match_with_cache(i, match,
 			&local_cache);
 		if (tainted) {
-		    OBJ_TAINT(tainted);
+		    OBJ_TAINT(substr);
 		}
 		rb_ary_push(scan_result, substr);
 	    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110116/d73269b0/attachment.html>


More information about the macruby-changes mailing list