[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[DotGNU]Read and ReadBlock bugs in pnet and pnetlib
From: |
Stephen Compall |
Subject: |
[DotGNU]Read and ReadBlock bugs in pnet and pnetlib |
Date: |
Wed, 29 Oct 2003 19:38:22 GMT |
Here are some bugs and patches:
In two places, one in pnet/engine/lib_stdio.c and one in
pnetlib/runtime/System/IO/TextReader.cs, the return value isn't
computed correctly; 0 is returned instead. The former was breaking my
CGI library, which I will present in my next message.
The third problem, also in pnetlib/runtime/System/IO/TextReader.cs,
was ReadBlock's failure to continue writing at the index offset by the
amount of data read so far. While the current implementations of Read
all block until all data is read, thus hiding this bug, someone could
still override Write, following spec but still breaking it.
pnet fix:
http://csserver.evansville.edu/~sc87/dotgnu/pnet-StdRead-retval.patch
pnetlib fixes:
http://csserver.evansville.edu/~sc87/dotgnu/pnetlib-Read-retval.patch
Here is proof of the pnet bug, which was breaking my library:
// -*- compile-command: "cscc -o rw_count.exe rw_count.cs" -*-
// This is a test function for System.IO.TextWriter.ReadBlock. It
// tests the function on Console.In, by reading
public class Rw_count
{
public static int Main (String[] arguments)
{
if (arguments.Length != 1)
{
Console.Error.WriteLine ("Usage: rw_count NUMCHARS");
return 1;
}
int data_size = Int32.Parse (arguments[0]);
char[] data = new char[data_size];
Console.Error.Write ("Content-length: ");
Console.Error.WriteLine
(Console.In.Read (data, 0, data_size).ToString ());
Console.Out.Write (data);
return 0;
}
}
--
Stephen Compall or s11 or sirian
There are three things I always forget. Names, faces -- the third I
can't remember.
-- Italo Svevo
covert video arrangements codes dictionary Sears Tower Albanian Kh-11
MD5 Manfurov constitution diwn Cohiba radar [Hello to all my friends
and fans in domestic surveillance] high security
- [DotGNU]Read and ReadBlock bugs in pnet and pnetlib,
Stephen Compall <=