[Mono-devel-list] Re: Abcremoval

Willibald Krenn Willibald.Krenn at gmx.at
Tue Feb 1 12:51:16 EST 2005


Jonathan Gilbert schrieb:

> This will cause bad behaviour if the user does "my_string[-1]" for a
> typical (much shorter than 4 gigabytes) string...

I don't think so, because of bounds-checking:

cmp    %eax,0x10(%rcx) /*0x10(%rcx) is strlen*/
jbe    <exception>     /*unsigned compare*/
shl    %eax	
/*no signed widening here*/
add    %rcx,%rax /*rcx is pointer to string; rax is index by two */
movzwq 0x14(%rax),%r14 /*copy*/

On x86 I can not imagine that a string of len 0x40000000 = 1024*2 MB is 
possible.

Correct me if I'm wrong.

   Willi




More information about the Mono-devel-list mailing list