Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: (PR#6585) Delta version 9
Home

[Freeciv-Dev] Re: (PR#6585) Delta version 9

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#6585) Delta version 9
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Tue, 18 Nov 2003 03:58:26 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6585 >

On Mon, Nov 17, 2003 at 09:21:30PM -0800, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=6585 >
> 
> Raimar Falke wrote:
> > On Sat, Nov 15, 2003 at 09:07:21AM -0800, Arnstein Lindgard wrote:
> > 
> >><URL: http://rt.freeciv.org/Ticket/Display.html?id=6585 >
> >>
> >>
> >>1)
> >>
> >>civserver
> >>
> >>>set ai 7
> >>
> >>civclient
> >>(connect)
> >>(start)
> >>(select nation)
> >>
> >>Crash.
> >>
> >>civclient: packets.c:330: get_packet_from_connection: Assertion
> >>`error == 0' failed.
> > 
> > The decompression buffer wasn't large enough.
> 
> The fact that this error is even possible is very bad.
> 
> Libz is good for decompressing linearly; shouldn't we be able to specify 
> a maximum buffer size and decompress in clumps if necessary?

This is not an internal decompression buffer but the target of the
decompression. Sorry if I used the term "buffer" here. You have to
write the decompressed somewhere. Decompressing in chunks doesn't
change this.

> Otherwise, given an unbounded ratio of compression we have an
> unsolvable security-versus-correctness problem.

The freeciv's decompression space is limited to 100*compressed size =
3.2 MB at most. Since this factor isn't needed everytime it may
possible to redoce it like:
  get buffer of size compressed_size * 3
  for(;;)
    error=decompress()
    if(error==buffer_too_small)
       enlarge buffer by factor of 2
       continue
    assert(error=Z_OK);
    break;

The cost/benefit ratio is too bad.

Zlib may use other buffers inside the library.

Note that there is another problem. The sender (mostly the server)
will assert if the compressed queue doesn't fit into a packet
(32k). If this problem occurs in the wild I will fix it by sending
multiple compressed packet.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Despite all the medical advances of the 20th century, the mortality 
  rate remains unchanged at 1 death per person."




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