Damien COUDERC wrote:
Hi, i have problems with dillo on sparc64. When using a mechanism of OpenBSD 's malloc i'm able to detect a bug in the dpi stuff. At the moment i've found that the function Dpi_append_io_buf() in the file src/IO/dpi.c is wrong.
The following line is reallocating a buffer: conn->Buf = g_realloc(conn->Buf, (gulong)io->Status);
But when debugging the values of io->Status don't seem to be adequate. I haven't been able to completely fix it as the code is seriously lacking of comment. To be honest i don't even completely understand what this chunk is doing and the code is so unreadable that it doesn't help (not to be harsh but just to give my humble opinion).
in the file src/IO/IO.h, in the function static gboolean IO_read(IOData_t *io) there is at line 464 (in last stable release 0.8.4) io->Status = St; but that is true only if not have been read some more data with DataPending = TRUE; which repeate while and it is in the last else that was wrongly commented as /* BytesRead == io->BufSize */ while that conditions is /* BytesRead == io->BufSize */ So in few words the patch I propose is: io->Status = 0; //HERE do { ret = FALSE; DataPending = FALSE; St = read(io->FD, io->Buf, io->BufSize); io->Status += St; //AND HERE obviuosly who read have to free the previous buffer and set io->Status to zero... but in IMHO because the io struct has a flag wich tell us if there is something allocated is a good idea to use it and also free the buffers whose are sent to be read but not freed before. Cheers, -- Roberto A. Foglietta Analista Programmatore GNU/Linux SAD Trasporto Locale S.p.a. Corso Italia 13/N 39100 BOLZANO (I) Tel. +39/0471-450.261 Fax +39/0471-450.253