[macruby-changes] [4925] MacRuby/trunk/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Sun Nov 21 07:38:05 PST 2010
Revision: 4925
http://trac.macosforge.org/projects/ruby/changeset/4925
Author: watson1978 at gmail.com
Date: 2010-11-21 07:38:02 -0800 (Sun, 21 Nov 2010)
Log Message:
-----------
String#succ will copy the status of taint and untrust.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
str = 'abcd'
str.taint
str.untrust
str.freeze
s = str.succ
assert_equal(true, s.tainted?)
assert_equal(true, s.untrusted?)
assert_equal(false, s.frozen?)
puts :ok
}}}
Modified Paths:
--------------
MacRuby/trunk/string.c
Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c 2010-11-21 14:41:39 UTC (rev 4924)
+++ MacRuby/trunk/string.c 2010-11-21 15:38:02 UTC (rev 4925)
@@ -4864,6 +4864,14 @@
VALUE newstr = rb_unicode_str_new(chars_ptr, len);
free(chars_buf);
+
+ if (OBJ_TAINTED(str)) {
+ OBJ_TAINT(newstr);
+ }
+ if (OBJ_UNTRUSTED(str)) {
+ OBJ_UNTRUST(newstr);
+ }
+
return newstr;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101121/8f9b70a0/attachment.html>
More information about the macruby-changes
mailing list