chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] read-u8vector! from tcp port


From: Hans Bulfone
Subject: Re: [Chicken-users] read-u8vector! from tcp port
Date: Tue, 29 Jan 2008 21:21:22 +0100
User-agent: Mutt/1.5.16 (2007-06-09)

hi graham,

On Tue, Jan 29, 2008 at 02:44:18PM -0500, Graham Fawcett wrote:
> Hi Hans,
> 
> On Jan 28, 2008 7:38 PM, Hans Bulfone <address@hidden> wrote:
> > on my system (linux-amd64) when i use read-u8vector! to read from a
> > port created by tcp-accept or tcp-connect and give #f as LENGTH, i get
> > the unrealistic error:
> >
> > out of memory - heap full while resizing - execution terminated
> 
> Yeah, that's a ugly error message. But what would it mean to read an
> arbitrary-length string from a network port?

it's not supposed to read an arbitrary-length string; it should read
into the provided u8-vector until it is full. [1]

imho either the read-string! implementation in the tcp unit should
check for its length parameter (n) being #f or read-u8vector!
shouldn't pass #f as n to ##sys#read-string! in the first place.
probably the latter as ##sys#custom-input-port's implementation
of read-string! (in posixunix.scm) doesn't seem to check for #f
either.

btw. this is with chicken 2.732 but after a quick check i think it's
the same in trunk.

bye,
hans.

[1] http://chicken.wiki.br/Unit%20srfi-4:

[procedure] (read-u8vector! LENGTH U8VECTOR [PORT [START]])

Reads LENGTH bytes from the PORT writing the read input into U8VECTOR
beginning at START (or 0 if not given). PORT defaults to the value of
(current-input-port). If LENGTH is #f, the vector will be filled
completely until end-of-file is reached. This procedure returns the
number of bytes read.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]