pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix yet another bug in archive streamer with LZ4 decompression.
Date: Wed, 04 Mar 2026 17:08:50 +0000
Message-ID: <E1vxpiM-002O4m-3B@gemulon.postgresql.org> (raw)

Fix yet another bug in archive streamer with LZ4 decompression.

The code path in astreamer_lz4_decompressor_content() that updated
the output pointers when the output buffer isn't full was wrong.
It advanced next_out by bytes_written, which could include previous
decompression output not just that of the current cycle.  The
correct amount to advance is out_size.  While at it, make the
output pointer updates look more like the input pointer updates.

This bug is pretty hard to reach, as it requires consecutive
compression frames that are too small to fill the output buffer.
pg_dump could have produced such data before 66ec01dc4, but
I'm unsure whether any files we use astreamer with would be
likely to contain problematic data.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/415cc943ffdd591c513cc9c526d219095e72a278

Modified Files
--------------
src/bin/pg_basebackup/bbstreamer_lz4.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1vxpiM-002O4m-3B@gemulon.postgresql.org>
Permalink:  ../E1vxpiM-002O4m-3B@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vxpiM-002O4m-3B@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix yet another bug in archive streamer with LZ4 decompression.
  In-Reply-To: <E1vxpiM-002O4m-3B@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