[Mono-bugs] [Bug 79106][Nor] New - Mono.Unix.Native.Syscall.readlink crashes when passed empty StringBuilder

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Aug 18 19:44:41 EDT 2006


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 ziktar at deadmoose.com.

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

--- shadow/79106	2006-08-18 19:44:41.000000000 -0400
+++ shadow/79106.tmp.22797	2006-08-18 19:44:41.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 79106
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Ubuntu 6.06; mono 1.1.13.6
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Mono.POSIX
+AssignedTo: miguel at ximian.com                            
+ReportedBy: Ziktar at DeadMoose.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono.Unix.Native.Syscall.readlink crashes when passed empty StringBuilder
+
+Description of Problem:
+
+Calling Mono.Unix.Native.Syscall.readlink with an empty StringBuilder will
+crash (not throw an exception, but SIGSEGV).
+
+Steps to reproduce the problem:
+
+1) Save the following code to ReadLink.cs
+---
+using System;
+using System.Text;
+using Mono.Unix.Native;
+
+namespace PipeReader
+{
+	public class PipeReader
+	{
+		static int Main(string[] args)
+
+		{
+			StringBuilder buf = new StringBuilder();
+			Syscall.readlink("/usr/bin/mozilla-firefox", buf);
+			
+			Console.WriteLine(buf.ToString());
+			
+			return 0;	
+		}
+	}
+}
+----
+2) Change /usr/bin/mozilla-firefox to something that is a symlink
+3) Run mcs -r:Mono.Posix.dll ReadLink.cs  && mono ReadLink.exe
+
+Actual Results:
+
+SIGSEGV or other crash
+
+Expected Results:
+
+Either an empty string, an exception, or something less deadly.
+
+How often does this happen? 
+
+Every time.
+
+Additional Information:
+
+Note that calling this with a "new StringBuffer(x);" where x >= 0 will work.


More information about the mono-bugs mailing list