Ver código fonte

2005-11-11 Sebastien Pouliot <[email protected]>

	* StringBuilder.cs: Fix ISerializable.GetObjectData (remoting tests 
	were failing under 2.0) and two possible integer overflow in CopyTo.


svn path=/trunk/mcs/; revision=52933
Sebastien Pouliot 20 anos atrás
pai
commit
69605a115b

+ 5 - 0
mcs/class/corlib/System.Text/ChangeLog

@@ -1,3 +1,8 @@
+2005-11-11  Sebastien Pouliot  <[email protected]>
+
+	* StringBuilder.cs: Fix ISerializable.GetObjectData (remoting tests 
+	were failing under 2.0) and two possible integer overflow in CopyTo.
+
 2005-11-11  Miguel de Icaza  <[email protected]>
 
 	* StringBuilder.cs (Text): Added serialization support in 2.x. 

+ 3 - 3
mcs/class/corlib/System.Text/StringBuilder.cs

@@ -687,8 +687,8 @@ namespace System.Text {
 		{
 			if (destination == null)
 				throw new ArgumentNullException ("destination");
-			if ((Length < sourceIndex + count) ||
-			    (destination.Length < destinationIndex + count) ||
+			if ((Length - count < sourceIndex) ||
+			    (destination.Length -count < destinationIndex) ||
 			    (sourceIndex < 0 || destinationIndex < 0 || count < 0))
 				throw new ArgumentOutOfRangeException ();
 
@@ -700,7 +700,7 @@ namespace System.Text {
 		{
 			info.AddValue ("m_MaxCapacity", _maxCapacity);
 			info.AddValue ("Capacity", Capacity);
-			info.AddValue ("m_StringValue", _str);
+			info.AddValue ("m_StringValue", ToString ());
 			info.AddValue ("m_currentThread", 0);
 		}