dotgnu-general
[Top][All Lists]
Advanced

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

[DotGNU]A bug in String.InsertSpace() (or StringBuilder)


From: Gopal V
Subject: [DotGNU]A bug in String.InsertSpace() (or StringBuilder)
Date: Tue, 8 Oct 2002 23:31:51 +0530
User-agent: Mutt/1.2.5i

Hi Rhys,
        I seem to have tracked down a bug in String.InsertSpace() ...
This is the source of the bug discovered by Jonathan Springer in
StringBuilder.Insert()... hmm... Trouble shooting also needs a good 
tracker and a nice gun :-)

StringBuilder sb=new StringBuilder("bar123456789");
sb.Insert(0,"foo");
Console.WriteLine(sb.ToString());

give "foobar123789" and not "foobar123456789"

Errant function is `void _IL_String_InsertSpace'
In File pnet/engine/lib_string.c : 733 

        ILMemMove(StringToBuffer(dest) + destPos,
                          StringToBuffer(dest) + srcPos, dest->length - srcPos);

Unfortunately the ILMemMove seems to overwrite the existing data if
the two regions overlap ?

lib_string.c:737 <bar123456789>
lib_string.c:740 <barbar123789>
foobar123789

This is what I get when I try to printf an ILStringToAnsi the dest
before and after the ILMemMove...

Gopal

/me is too lazy to debug ILMemMove tonight .... X-|
-- 
The difference between insanity and genius is measured by success


reply via email to

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