[Mono-bugs] [Bug 51741][Nor] New - System.IO.BinaryReader.PeekChar( ) modifies the underlying stream
Tue, 16 Mar 2004 14:56:16 -0500 (EST)
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 email@example.com.
--- shadow/51741 2004-03-16 14:56:16.000000000 -0500
+++ shadow/51741.tmp.22715 2004-03-16 14:56:16.000000000 -0500
@@ -0,0 +1,67 @@
+Product: Mono: Class Libraries
+OS: Red Hat 8.0
+Summary: System.IO.BinaryReader.PeekChar( ) modifies the underlying stream
+Description of Problem:
+PeekChar( ) on System.IO.BinaryReader modifies the underlying stream.
+Essentially, PeekChar( ) calls ReadChar( ) on the underlying stream but
+doesn't reposition the stream before returning. The 'peeked' char is
+placed into a buffer which is used for any subsequent ReadChar( ) call.
+This causes two problems.
+The first is that the underlying stream is not in the same state as it
+was before the call.
+The second is that if the position of the stream is changed after a call
+to PeekChar( ) a call to ReadChar( ) will return the invalid data from
+the PeekChar( ) call.
+Steps to reproduce the problem:
+Create a test application which uses a BinaryReader and also manipulates
+the underlying stream. ( attached )
+How often does this happen?
+The Microsoft .net implementation of this method does not modify the
+underlying stream. If the underlying stream is not seekable then PeekChar
+( ) return -1.
+------- Additional Comments From firstname.lastname@example.org 2003-12-04 17:12 -------
+Created an attachment (id=6113)
+Test case class
+------- Additional Comments From email@example.com 2003-12-04 17:13 -------
+Created an attachment (id=6114)
+------- Additional Comments From firstname.lastname@example.org 2003-12-04 17:31 -------
+Created an attachment (id=6115)
+The proposed fix in diff -u format
+------- Additional Comments From email@example.com 2004-03-16 14:56 -------
+I will apply it after mono 0.31 is out.