pgsql: Advance input pointer when LZ4 compressing data

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Advance input pointer when LZ4 compressing data
Date: 2023-05-17 15:00:59
Message-ID: E1pzIeC-000Lpb-8L@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Advance input pointer when LZ4 compressing data

LZ4File_write() did not advance the input pointer on subsequent invocations of
LZ4F_compressUpdate(). As a result the generated compressed output would be a
compressed version of the same input chunk.

Tests failed to catch this error because the data would comfortably fit
within the default buffer size, as a single chunk. Tests have been added
to provide adequate coverage of multi-chunk compression.

WriteDataToArchiveLZ4() which is also using LZ4F_compressUpdate() did
not suffer from this omission.

Author: Georgios Kokolatos <gkokolatos(at)pm(dot)me>
Reported-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/ZFhCyn4Gm2eu60rB%40paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1a05c1d252993b0a59c58a6daf91a2df9333044f

Modified Files
--------------
src/bin/pg_dump/compress_io.h | 8 ++++++-
src/bin/pg_dump/compress_lz4.c | 2 ++
src/bin/pg_dump/t/002_pg_dump.pl | 46 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-05-17 15:14:16 pgsql: Fix some issues with improper placement of outer join clauses.
Previous Message Thom Brown 2023-05-17 14:58:21 Re: pgsql: Null-terminate the output buffer of LZ4Stream_gets