[Mono-bugs] [Bug 623767] New: File.IO.TextReader and File.IO.StreamReader wrong logic

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 20 02:58:15 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=623767

http://bugzilla.novell.com/show_bug.cgi?id=623767#c0


           Summary: File.IO.TextReader and File.IO.StreamReader wrong
                    logic
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: normalex at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4
(KHTML, like Gecko) Chrome/5.0.375.55 Safari/533.4

File.IO.StreamReader
Read(char[] buffer, int index, int count)

446                // re-ordered to avoid possible integer overflow
447                if (index > buffer.Length - count)
448                    throw new ArgumentException ("index + count >
buffer.Length");

Should be simple: IF count > buffer.Length throw BufferIsTooSmallException

and

File.IO.TextReader
ReadBlock (char [] buffer, int index, int count)

the whole method implementation should be deleted, because it doesn't block and
the most important the do while loop is nonsense.

Reproducible: Always

Steps to Reproduce:
1. Try to read any file with File.IO.StreamReader.Read(char[] buffer, int
index, int count)
2.
3.
Actual Results:  
ArgumentException ("index + count > buffer.Length")

Expected Results:  
read chars in the specified buffer.

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


More information about the mono-bugs mailing list