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: Avoid direct C access to possibly-null pg_subscription_rel.srsub
Date: Tue, 21 Jul 2020 15:40:59 +0000
Message-ID: <E1jxuO3-0001yw-Qe@gemulon.postgresql.org> (raw)

Avoid direct C access to possibly-null pg_subscription_rel.srsublsn.

This coding technique is unsafe, since we'd be accessing off the end
of the tuple if the field is null.  SIGSEGV is pretty improbable, but
perhaps not impossible.  Also, returning garbage for the LSN doesn't
seem like a great idea, even if callers aren't looking at it today.

Also update docs to point out explicitly that
pg_subscription.subslotname and pg_subscription_rel.srsublsn
can be null.

Perhaps we should mark these two fields BKI_FORCE_NULL, so that
they'd be correctly labeled in databases that are initdb'd in the
future.  But we can't force that for existing databases, and on
balance it's not too clear that having a mix of different catalog
contents in the field would be wise.

Apply to v10 (where this code came in) through v12.  Already
fixed in v13 and HEAD.

Discussion: https://postgr.es/m/732838.1595278439@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/99b0c5da3e10a9f64ed2790ed34d8de3075edb20

Modified Files
--------------
doc/src/sgml/catalogs.sgml                |  9 ++++++---
src/backend/catalog/pg_subscription.c     | 18 ++++++++++++++++--
src/include/catalog/pg_subscription_rel.h | 13 +++++++++++--
3 files changed, 33 insertions(+), 7 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1jxuO3-0001yw-Qe@gemulon.postgresql.org>
Permalink:  ../E1jxuO3-0001yw-Qe@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jxuO3-0001yw-Qe@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid direct C access to possibly-null pg_subscription_rel.srsub
  In-Reply-To: <E1jxuO3-0001yw-Qe@gemulon.postgresql.org>
  References: <E1jxuO3-0001yw-Qe@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