[Mono-dev] [PATCH] Managed Marshal.Copy implemantations

Kornél Pál kornelpal at gmail.com
Thu Dec 20 08:21:53 EST 2007

Attached an update patch to this message.

Please see the comments in

>> What is that bug?
>Integer overflow when doing the array range check.

Thanks for pointing this out, I believed that my checks were correct but now 
I realized that my version is still insufficient.

>> I don't see any reason for that check because as far as I know byte[,] 
>> for
>> example cannot be casted to byte[]. Did I miss something?
>It's an extra check because the shared methods will have Array as the
>type and they could be misused.

They are private so I prefer not to be used anywhere else than extra checks. 
(I added comments before these methods about that.)

>Until we support precise stack scanning in the GC it's not an issue
>and you can use a simple IntPtr. When we'll add that support, the JIT
>will be changed to insert an explicit pinning pointer local variable
>to store the result of the new internal call.

OK, thanks for the explanation, now I understand how this works.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: managed_copy.diff
Type: application/octet-stream
Size: 11437 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071220/3855d81d/attachment.obj 

More information about the Mono-devel-list mailing list