Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Commit

Permalink
Update Array#inspect to taint result strings correctly as per rubyspec
Browse files Browse the repository at this point in the history
  • Loading branch information
Orion Edwards [GGL] committed Feb 1, 2012
1 parent ae966af commit c89e236
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Languages/Ruby/Libraries/Extensions/IListOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,10 @@ private static void JoinRecursive(JoinConversionStorage/*!*/ conversions, IList/
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) {
Expand All @@ -1614,7 +1618,10 @@ private static void JoinRecursive(JoinConversionStorage/*!*/ conversions, IList/
} else {
str.Append(", ");
}
str.Append(context.Inspect(obj));

var objInspected = context.Inspect(obj);
str.Append(objInspected);
str.TaintBy(objInspected);
}
str.Append(']');
return str;
Expand Down

0 comments on commit c89e236

Please sign in to comment.