pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix detection of truncated zstd and LZ4 dump data
Date: Fri, 09 Oct 2026 11:43:31 +0000
Message-ID: <E1xF90d-00000000wQp-1OOq@gemulon.postgresql.org> (raw)

Fix detection of truncated zstd and LZ4 dump data

pg_restore did not verify that zstd and LZ4 decompression completed
the final frame when reading custom and directory-format dumps. As a
result, it could accept a dump whose compressed data was truncated.

Track final-frame completion and reject incomplete compressed input.
For zstd, flush any internally buffered output before performing the
final check.

Add regression tests for truncated zstd and LZ4 data in custom and
directory-format dumps and also address a potentially empty error
message while in there.

Author: Chao Li <lic@highgo.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/5962B878-C43D-4EBC-9E95-1F945CE5E586@gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/bin/pg_dump/compress_gzip.c           |   6 +-
src/bin/pg_dump/compress_lz4.c            |  30 ++++++-
src/bin/pg_dump/compress_zstd.c           |  67 ++++++++++++++-
src/bin/pg_dump/t/006_pg_dump_compress.pl | 136 ++++++++++++++++++++++++++++++
4 files changed, 233 insertions(+), 6 deletions(-)



view thread (2+ messages)

Message-ID: <E1xF90d-00000000wQp-1OOq@gemulon.postgresql.org>
Permalink:  ../E1xF90d-00000000wQp-1OOq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xF90d-00000000wQp-1OOq@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: dgustafsson@postgresql.org
  Subject: Re: pgsql: Fix detection of truncated zstd and LZ4 dump data
  In-Reply-To: <E1xF90d-00000000wQp-1OOq@gemulon.postgresql.org>
  References: <E1xF90d-00000000wQp-1OOq@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox