[Mono-bugs] [Bug 564307] New: BitConverter - Erroneous error description 'source' called 'destination'

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Dec 12 22:00:49 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=564307

http://bugzilla.novell.com/show_bug.cgi?id=564307#c0


           Summary: BitConverter - Erroneous error description 'source'
                    called 'destination'
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: Customer_Relevant, easy_fix, English, Linguistic
          Severity: Minor
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cipherjason at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development
           Blocker: No


In the System.BitConverter source code, there are several errors raised, which
refer to a Destination array not being long enough, when clearly this should be
called a Source array.  PutBytes contains a clear example of why this is wrong.
 All errors similar to this require review to make them correct.

Also, as a result of massive copying and pasting, a comment line which should
be associated with the code above is attached to this particular error
condition instead.  This should be moved and copied to the other similar
correct places, or removed.


For reference this is the state of PutBytes at the time of filing the bug:

        unsafe static void PutBytes (byte *dst, byte[] src, int start_index,
int count)
        {
            if (src == null)
                throw new ArgumentNullException ("value");

            if (start_index < 0 || (start_index > src.Length - 1))
                throw new ArgumentOutOfRangeException ("startIndex", "Index
was"
                    + " out of range. Must be non-negative and less than the"
                    + " size of the collection.");

            // avoid integer overflow (with large pos/neg start_index values)
            if (src.Length - count < start_index)
                throw new ArgumentException ("Destination array is not long"
                    + " enough to copy all the items in the collection."
                    + " Check array index and length.");

            for (int i = 0; i < count; i++)
                dst[i] = src[i + start_index];
        }

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list