[Mono-bugs] [Bug 411115] New: LosFormatter.Deserialize(s) requires s.CanSeek

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jul 21 19:34:03 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=411115


           Summary: LosFormatter.Deserialize(s) requires s.CanSeek
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: dean at brettle.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Description of Problem:

Passing an unseekable stream to LosFormatter.Deserialize() causes an exception.
 That is not true for MS's implementation

How often does this happen? 

Everytime

The following (untested) patch should fix the problem:


Index: LosFormatter.cs
===================================================================
--- LosFormatter.cs     (revision 108427)
+++ LosFormatter.cs     (working copy)
@@ -71,7 +71,7 @@
                        if (stream == null)
                                throw new ArgumentNullException ("stream");

-                       byte [] bytes = new byte [stream.Length >= 0 ?
stream.Length : 2048];
+                       byte [] bytes = new byte [stream.CanSeek &&
stream.Length >= 0 ? stream.Length : 2048];
                        MemoryStream ms = null;
                        if ((stream is MemoryStream) && stream.Position == 0) {
                                // We save allocating a new stream and reading
in this case.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list