pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix multiple bugs in astreamer pipeline code.
Date: Sun, 29 Mar 2026 13:15:48 +0000
Message-ID: <E1w6pzX-001zl4-1i@gemulon.postgresql.org> (raw)

Fix multiple bugs in astreamer pipeline code.

astreamer_tar_parser_content() sent the wrong data pointer when
forwarding MEMBER_TRAILER padding to the next streamer.  After
astreamer_buffer_until() buffers the padding bytes, the 'data'
pointer has been advanced past them, but the code passed 'data'
instead of bbs_buffer.data.  This caused the downstream consumer
to receive bytes from after the padding rather than the padding
itself, and could read past the end of the input buffer.

astreamer_gzip_decompressor_content() only checked for
Z_STREAM_ERROR from inflate(), silently ignoring Z_DATA_ERROR
(corrupted data) and Z_MEM_ERROR (out of memory).  Fix by
treating any return other than Z_OK, Z_STREAM_END, and
Z_BUF_ERROR as fatal.

astreamer_gzip_decompressor_free() missed calling inflateEnd() to
release zlib's internal decompression state.

astreamer_tar_parser_free() neglected to pfree() the streamer
struct itself, leaking it.

astreamer_extractor_content() did not check the return value of
fclose() when closing an extracted file.  A deferred write error
(e.g., disk full on buffered I/O) would be silently lost.

Discussion: https://postgr.es/m/results/98c6b630-acbb-44a7-97fa-1692ce2b827c@dunslane.net

Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>

Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d3bb7841b4be7e7aad0bd666117c022acb5a2c64

Modified Files
--------------
src/bin/pg_basebackup/bbstreamer_file.c |  4 +++-
src/bin/pg_basebackup/bbstreamer_gzip.c | 10 ++++++++--
src/bin/pg_basebackup/bbstreamer_tar.c  |  4 +++-
3 files changed, 14 insertions(+), 4 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1w6pzX-001zl4-1i@gemulon.postgresql.org>
Permalink:  ../E1w6pzX-001zl4-1i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w6pzX-001zl4-1i@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: andrew@dunslane.net, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix multiple bugs in astreamer pipeline code.
  In-Reply-To: <E1w6pzX-001zl4-1i@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