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: Fix off-by-one loop termination condition in pg_stat_get_subscri
Date: Tue, 07 Jun 2022 19:34:45 +0000
Message-ID: <E1nyeyT-003BgZ-Dt@gemulon.postgresql.org> (raw)

Fix off-by-one loop termination condition in pg_stat_get_subscription().

pg_stat_get_subscription scanned one more LogicalRepWorker array entry
than is really allocated.  In the worst case this could lead to SIGSEGV,
if the LogicalRepCtx data structure is near the end of shared memory.
That seems quite unlikely though (thanks to the ordering of calls in
CreateSharedMemoryAndSemaphores) and we've heard no field reports of it.
A more likely misbehavior is one row of garbage data in the function's
result, but even that is not real likely because of the check that the
pid field matches some live backend.

Report and fix by Kuntal Ghosh.  This bug is old, so back-patch
to all supported branches.

Discussion: https://postgr.es/m/CAGz5QCJykEDzW6jQK6Yz7Qh_PMtD=95de_7QoocbVR2Qy8hWZA@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/435251b859ab2af8d138b4d29b9bb564e862530f

Modified Files
--------------
src/backend/replication/logical/launcher.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1nyeyT-003BgZ-Dt@gemulon.postgresql.org>
Permalink:  ../E1nyeyT-003BgZ-Dt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nyeyT-003BgZ-Dt@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: Fix off-by-one loop termination condition in pg_stat_get_subscri
  In-Reply-To: <E1nyeyT-003BgZ-Dt@gemulon.postgresql.org>
  References: <E1nyeyT-003BgZ-Dt@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