[Mono-bugs] [Bug 705140] New: Inplace copying doesn't work with Buffer.BlockCopy

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 12 07:31:00 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=705140

https://bugzilla.novell.com/show_bug.cgi?id=705140#c0


           Summary: Inplace copying doesn't work with Buffer.BlockCopy
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: GC
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: maciej.paszta at mlabs.pl
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=439401)
 --> (http://bugzilla.novell.com/attachment.cgi?id=439401)
Test case exposing the issue

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML,
like Gecko) Chrome/13.0.782.41 Safari/535.1

When a buffer is filled with data, and one tries to perform inplace copying of
the data (ie. data[4..24] is copied to data[5..24]) using Buffer.BlockCopy, the
resuling buffer contains incorrect values.

Reproducible: Always

Steps to Reproduce:
1. Run supplied test case
Actual Results:  
Out: 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27
28 29 30 31

Expected Results:  
Out: 0 1 2 3 4 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27
28 29 30 31

Seems like the offending code was commited in version:
5c82e32b6761aa522f1ca20836eba02ea4545642

especially the lines:
@@ -6228,7 +6228,7 @@ ves_icall_System_Buffer_BlockCopyInternal (MonoArray
*src, gint32 src_offset, Mo
        if (src != dest)
                memcpy (dest_buf, src_buf, count);
        else
-               memmove (dest_buf, src_buf, count); /* Source and dest are the
same array */
+               mono_gc_memmove (dest_buf, src_buf, count); /* Source and dest
are the same array */

        return TRUE;
 }

-- 
Configure bugmail: https://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