[Mono-bugs] [Bug 79106][Nor] Changed - Default-constructed StringBuilder unusable with P/Invoke
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Aug 20 19:56:32 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 jonpryor at vt.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=79106
--- shadow/79106 2006-08-18 19:44:41.000000000 -0400
+++ shadow/79106.tmp.9292 2006-08-20 19:56:32.000000000 -0400
@@ -1,23 +1,23 @@
Bug#: 79106
Product: Mono: Class Libraries
Version: 1.1
-OS:
+OS: unknown
OS Details: Ubuntu 6.06; mono 1.1.13.6
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Normal
-Component: Mono.POSIX
+Component: CORLIB
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
+Summary: Default-constructed StringBuilder unusable with P/Invoke
Description of Problem:
Calling Mono.Unix.Native.Syscall.readlink with an empty StringBuilder will
crash (not throw an exception, but SIGSEGV).
@@ -61,6 +61,23 @@
Every time.
Additional Information:
Note that calling this with a "new StringBuffer(x);" where x >= 0 will work.
+
+------- Additional Comments From jonpryor at vt.edu 2006-08-20 19:56 -------
+This appears to be a bug within System.Text.StringBuilder, where use
+of the default constructor sets StringBuilder._str to "", while
+StringBuilder((int)0) sets StringBuilder._str to a string of length
+StringBuilder.constDefaultCapacity.
+
+Result: use of the default constructor yields an unusable
+StringBuilder isntance (as far as P/Invoke is concerned).
+
+(Note: There is nothing that Mono.Unix.Native.Syscall.readlink() could
+do to check this, since the default-constructed StringBuilder returns
+a .Capacity of 16, so there's no way I know of to distinguish between
+a default-constructed and a non-default-constructed StringBuilder
+instance.)
+
+--> System.Text.StringBuilder bug.
More information about the mono-bugs
mailing list