From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check for relation length overrun soon enough.
Date: Thu, 09 Sep 2021 15:46:15 +0000
Message-ID: <E1mOMFj-0001Er-FN@gemulon.postgresql.org> (raw)
Check for relation length overrun soon enough.
We don't allow relations to exceed 2^32-1 blocks, because block
numbers are 32 bits and the last possible block number is reserved
to mean InvalidBlockNumber. There is a check for this in mdextend,
but that's really way too late, because the smgr API requires us to
create a buffer for the block-to-be-added, and we do not want to
have any buffer with blocknum InvalidBlockNumber. (Such a case
can trigger assertions in bufmgr.c, plus I think it might confuse
ReadBuffer's logic for data-past-EOF later on.) So put the check
into ReadBuffer.
Per report from Christoph Berg. It's been like this forever,
so back-patch to all supported branches.
Discussion: https://postgr.es/m/YTn1iTkUYBZfcODk@msg.credativ.de
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/7430c774209cd98bbc33076cc3c07497c1086d9a
Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 9 +++++++++
src/backend/storage/smgr/md.c | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
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: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Check for relation length overrun soon enough.
In-Reply-To: <E1mOMFj-0001Er-FN@gemulon.postgresql.org>
References: <E1mOMFj-0001Er-FN@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