dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.13,1.14


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Array.cs,1.13,1.14
Date: Tue, 26 Nov 2002 23:20:30 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv10561/runtime/System

Modified Files:
        Array.cs 
Log Message:


Fix the range-checking code in "Array.Copy" so that zero-length
copies at the end of an array actually work the way they are 
supposed to.


Index: Array.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Array.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** Array.cs    21 Nov 2002 01:02:47 -0000      1.13
--- Array.cs    27 Nov 2002 04:20:28 -0000      1.14
***************
*** 221,230 ****
                int dstLower = destinationArray.GetLowerBound(0);
                int dstLength = destinationArray.Length;
!               if(sourceIndex < srcLower)
                {
                        throw new ArgumentOutOfRangeException
                                ("sourceIndex", _("ArgRange_Array"));
                }
!               if(destinationIndex < dstLower)
                {
                        throw new ArgumentOutOfRangeException
--- 221,231 ----
                int dstLower = destinationArray.GetLowerBound(0);
                int dstLength = destinationArray.Length;
!               if(sourceIndex < srcLower || (sourceIndex - srcLower) > 
srcLength)
                {
                        throw new ArgumentOutOfRangeException
                                ("sourceIndex", _("ArgRange_Array"));
                }
!               if(destinationIndex < dstLower ||
!                  (destinationIndex - dstLower) > dstLength)
                {
                        throw new ArgumentOutOfRangeException
***************
*** 236,241 ****
                                ("length", _("ArgRange_NonNegative"));
                }
!               if((sourceIndex - srcLower) >= srcLength ||
!                  (destinationIndex - dstLower) >= dstLength)
                {
                        throw new ArgumentException(_("Arg_InvalidArrayRange"));
--- 237,242 ----
                                ("length", _("ArgRange_NonNegative"));
                }
!               if((srcLength - (sourceIndex - srcLower)) < length ||
!                  (dstLength - (destinationIndex - dstLower)) < length)
                {
                        throw new ArgumentException(_("Arg_InvalidArrayRange"));





reply via email to

[Prev in Thread] Current Thread [Next in Thread]