https://bugzilla.novell.com/show_bug.cgi?id=676060
https://bugzilla.novell.com/show_bug.cgi?id=676060#c0 Summary: System.IO.MemoryStream can throw NullReferenceExceptions when expanding internal buffer Classification: Mono Product: Mono: Class Libraries Version: 2.8.x Platform: x86-64 OS/Version: Ubuntu Status: NEW Severity: Normal Priority: P5 - None Component: Sys.Core AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 There is an issue with the setter for System.IO.MemoryStream.Capacity. In all constructors, MemoryStream initiates internalBuffer to some byte array, and the rest of the class is programmed with that assumption in mind. However, explicitly setting MemoryStream.Capacity = 0 will cause internalBuffer to be set to null. (see MemoryStream.cs lines 168 - 172 ) At this point, any calls to Expand or attempts to set Capacity will throw NullReferenceExceptions at line 165 of MemoryStream.cs Reproducible: Always Steps to Reproduce: 1. Create a new MemoryStream instance using any constructor 2. Write something to the memory stream 3. Explicitly set the instance's Position to 0 4. Explicitly set the instance's length to 0using SetLength() 5. Explicitly set the instance's Capacity property to 0 6. Try write something to the MemoryStream Actual Results: Throws a NullReferenceException at line 165 of MemoryStream.cs Expected Results: MemoryStream expands internal buffer properly and continues serializing values to internal buffer without throwing an exception -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
