ovsqlite (zlib edge-cases)

Bo Lindbergh 2bfjdsla52kztwejndzdstsxl9athp at gmail.com
Wed Dec 23 20:19:18 UTC 2020


Quoth Julien ÉLIE <julien at trigofacile.com>:
> A suggestion for close_db():
> 
> #ifdef HAVE_ZLIB
>    if (use_compression) {
>        inflateEnd(&inflation);
>        deflateEnd(&deflation);
>        buffer_free(flate);
>    }
> #endif

Good idea!  I'll include it in the upcoming patch.

The compression code might be excessively clever, so I'll add some clarifying
comments.  Brief version:

 1. deflation.avail_out is carefully set so that deflate fails to process
    everything in one pass exactly when compression doesn't save any space.

 2. inflation.avail_out is set to the uncompressed data size, so if inflate
    fails to process everything in one pass, the compressed data must be
    corrupted.


/Bo Lindbergh



More information about the inn-workers mailing list