[macruby-changes] [2343] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 17 11:08:15 PDT 2009


Revision: 2343
          http://trac.macosforge.org/projects/ruby/changeset/2343
Author:   pthomson at apple.com
Date:     2009-08-17 11:08:12 -0700 (Mon, 17 Aug 2009)
Log Message:
-----------
Ensured that Array#join's result is untrusted if the array, separator, or elements are untrusted, and enabled teh corresponding specs (also affects Array#*.).

Modified Paths:
--------------
    MacRuby/trunk/array.c
    MacRuby/trunk/spec/frozen/tags/macruby/core/array/join_tags.txt
    MacRuby/trunk/spec/frozen/tags/macruby/core/array/multiply_tags.txt

Modified: MacRuby/trunk/array.c
===================================================================
--- MacRuby/trunk/array.c	2009-08-17 05:25:57 UTC (rev 2342)
+++ MacRuby/trunk/array.c	2009-08-17 18:08:12 UTC (rev 2343)
@@ -1633,6 +1633,9 @@
     if (OBJ_FROZEN(ary)) {
 	OBJ_FREEZE(clone);
     }
+    if (OBJ_UNTRUSTED(ary)) {
+        OBJ_UNTRUST(clone);
+    }
     return clone;
 }
 
@@ -1660,6 +1663,7 @@
 {
     long i, count;
     int taint = Qfalse;
+    int untrust = Qfalse;
     VALUE result, tmp;
 
     if (RARRAY_LEN(ary) == 0) {
@@ -1668,6 +1672,9 @@
     if (OBJ_TAINTED(ary) || OBJ_TAINTED(sep)) {
 	taint = Qtrue;
     }
+    if (OBJ_UNTRUSTED(ary) || OBJ_UNTRUSTED(sep)) {
+        untrust = Qtrue;
+    }
     result = rb_str_new(0, 0);
 
     for (i = 0, count = RARRAY_LEN(ary); i < count; i++) {
@@ -1694,11 +1701,17 @@
 	if (OBJ_TAINTED(tmp)) {
 	    taint = Qtrue;
 	}
+	if (OBJ_UNTRUSTED(tmp)) {
+        untrust = Qtrue;
+	}
     }
 
     if (taint) {
 	OBJ_TAINT(result);
     }
+    if (untrust) {
+        OBJ_UNTRUST(result);
+    }
     return result;
 }
 

Modified: MacRuby/trunk/spec/frozen/tags/macruby/core/array/join_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/array/join_tags.txt	2009-08-17 05:25:57 UTC (rev 2342)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/array/join_tags.txt	2009-08-17 18:08:12 UTC (rev 2343)
@@ -2,6 +2,4 @@
 fails:Array#join returns a string formed by concatenating each element.to_s separated by separator without trailing separator
 fails:Array#join raises a NoMethodError if an element does not respond to #to_s
 fails:Array#join tries to convert the passed separator to a String using #to_str
-fails:Array#join does not consider untrustworthiness of either the array or the separator when the array is empty
-fails:Array#join returns a string which would be infected with untrustworthiness of the array, its elements or the separator when the array is not empty
 fails:Array#join calls #to_str to convert the separator to a String

Modified: MacRuby/trunk/spec/frozen/tags/macruby/core/array/multiply_tags.txt
===================================================================
--- MacRuby/trunk/spec/frozen/tags/macruby/core/array/multiply_tags.txt	2009-08-17 05:25:57 UTC (rev 2342)
+++ MacRuby/trunk/spec/frozen/tags/macruby/core/array/multiply_tags.txt	2009-08-17 18:08:12 UTC (rev 2343)
@@ -1,4 +1,3 @@
 critical:Array#* with a string raises an ArgumentError when the Array is recursive
 fails:Array#* with a string returns a string formed by concatenating each element.to_s separated by separator without trailing separator
 fails:Array#* with a string raises a NoMethodError if an element does not respond to #to_s
-fails:Array#* with a string returns a string which would be infected with untrustworthiness of the array, its elements or the separator when the array is not empty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090817/088de2d9/attachment.html>


More information about the macruby-changes mailing list