pgsql: Improve pglz_decompress() so that it cannot clobber memory beyond

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve pglz_decompress() so that it cannot clobber memory beyond
Date: 2008-03-08 01:09:36
Message-ID: 20080308010936.7B454753F32@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Improve pglz_decompress() so that it cannot clobber memory beyond the
available output buffer when presented with corrupt input. Some testing
suggests that this slows the decompression loop about 1%, which seems an
acceptable price to pay for more robustness. (Curiously, the penalty
seems to be *less* on not-very-compressible data, which I didn't expect
since the overhead per output byte ought to be more in the literal-bytes
path.)

Patch from Zdenek Kotala. I fixed a corner case and did some renaming
of variables to make the routine more readable.

Modified Files:
--------------
pgsql/src/backend/utils/adt:
pg_lzcompress.c (r1.30 -> r1.31)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/pg_lzcompress.c?r1=1.30&r2=1.31)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2008-03-08 01:16:26 pgsql: Improve efficiency of attribute scanning in
Previous Message Tom Lane 2008-03-08 00:39:53 Re: pgsql: Fix memory arrangement of tsquery after removing stop words.