pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix read beyond buffer bug introduced by the split xlog.c patch.
Date: Wed, 16 Feb 2022 10:02:02 +0000
Message-ID: <E1nKH8M-0004Oz-34@gemulon.postgresql.org> (raw)

Fix read beyond buffer bug introduced by the split xlog.c patch.

FinishWalRecovery() copied the valid part of the last WAL block into a
palloc'd buffer, and the code in StartupXLOG() copied it to the WAL
buffer. But the memcpy in StartupXLOG() copied a full 8kB block, not
just the valid part, i.e. it copied from beyond the end of the buffer.
The invalid part was cleared immediately afterwards, so as long as the
memory was allocated and didn't segfault, it didn't do any harm, but
it can definitely segfault.

Discussion: https://www.postgresql.org/message-id/efc12e32-5af2-3485-5b1d-5af9f707491a@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9ed87a78e0377728588e5c8688202195694581aa

Modified Files
--------------
src/backend/access/transam/xlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



Message-ID: <E1nKH8M-0004Oz-34@gemulon.postgresql.org>
Permalink:  ../E1nKH8M-0004Oz-34@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nKH8M-0004Oz-34@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: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Fix read beyond buffer bug introduced by the split xlog.c patch.
  In-Reply-To: <E1nKH8M-0004Oz-34@gemulon.postgresql.org>
  References: <E1nKH8M-0004Oz-34@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