[Mono-bugs] [Bug 54988][Maj] New - String.Replace() produces incorrect results and corrupts memory.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 28 Feb 2004 19:21:10 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jaak@zd.com.pl.

http://bugzilla.ximian.com/show_bug.cgi?id=54988

--- shadow/54988	2004-02-28 19:21:10.000000000 -0500
+++ shadow/54988.tmp.24833	2004-02-28 19:21:10.000000000 -0500
@@ -0,0 +1,40 @@
+Bug#: 54988
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Fedora 1.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jaak@zd.com.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: String.Replace() produces incorrect results and corrupts memory.
+
+Compile and run this 7-liner:
+
+=================================
+using System;
+public class C1 {
+    static void Main() {
+        string s = "...aaaaaaa.bbbbbbbbb,............ccccccc.u...";
+        Console.WriteLine("'{0}'", s.Replace("..", "."));
+    }
+}
+=================================
+
+Output: 
+
+Mono/Linux:   '..aaaaaaa.bbbbbbbbb,......cccc'
+.NET/Windows: '..aaaaaaa.bbbbbbbbb,......ccccccc.u..'
+
+Obviously the results produced on mono aren't correct. Additionally the app
+hangs and I have to use ^C to quit, which suggests some nasty memory
+corruption.
+
+I use Mono from CVS, Fedora Core 1.