Skip to content
Browse files

Update Array#inspect to taint result strings correctly as per rubyspec

  • Loading branch information...
1 parent ae966af commit c89e236a9471451b3a13c176c9ab7d7bce2fc154 Orion Edwards [GGL] committed Feb 1, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 Languages/Ruby/Libraries/Extensions/IListOps.cs
View
9 Languages/Ruby/Libraries/Extensions/IListOps.cs
@@ -1606,6 +1606,10 @@ public static class IListOps {
return MutableString.CreateAscii("[...]");
}
MutableString str = MutableString.CreateMutable(RubyEncoding.Binary);
+ if (self.Count > 0) { // tainted empty arrays don't taint the inspect string if the array is empty
+ str.TaintBy(self, context);
+ }
+
str.Append('[');
bool first = true;
foreach (object obj in self) {
@@ -1614,7 +1618,10 @@ public static class IListOps {
} else {
str.Append(", ");
}
- str.Append(context.Inspect(obj));
+
+ var objInspected = context.Inspect(obj);
+ str.Append(objInspected);
+ str.TaintBy(objInspected);
}
str.Append(']');
return str;

0 comments on commit c89e236

Please sign in to comment.
Something went wrong with that request. Please try again.