pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix edge-case for xl_tot_len broken by bae868ca.
Date: Mon, 25 Sep 2023 22:12:18 +0000
Message-ID: <E1qktoQ-005wg6-Iz@gemulon.postgresql.org> (raw)

Fix edge-case for xl_tot_len broken by bae868ca.

bae868ca removed a check that was still needed.  If you had an
xl_tot_len at the end of a page that was too small for a record header,
but not big enough to span onto the next page, we'd immediately perform
the CRC check using a bogus large length.  Because of arbitrary coding
differences between the CRC implementations on different platforms,
nothing very bad happened on common modern systems.  On systems using
the _sb8.c fallback we could segfault.

Restore that check, add a new assertion and supply a test for that case.
Back-patch to 12, like bae868ca.

Tested-by: Tom Lane <tgl@sss.pgh.pa.us>
Tested-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGLCkTT7zYjzOxuLGahBdQ%3DMcF%3Dz5ZvrjSOnW4EDhVjT-g%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/xlogreader.c | 11 +++++++++++
src/test/recovery/t/039_end_of_wal.pl   | 13 +++++++++++++
2 files changed, 24 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1qktoQ-005wg6-Iz@gemulon.postgresql.org>
Permalink:  ../E1qktoQ-005wg6-Iz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qktoQ-005wg6-Iz@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: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix edge-case for xl_tot_len broken by bae868ca.
  In-Reply-To: <E1qktoQ-005wg6-Iz@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