pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix possible NULL pointer dereference in GetNamedDSMSegment().
Date: Tue, 23 Jan 2024 02:45:24 +0000
Message-ID: <E1rS6my-002fhV-62@gemulon.postgresql.org> (raw)

Fix possible NULL pointer dereference in GetNamedDSMSegment().

GetNamedDSMSegment() doesn't check whether dsm_attach() returns
NULL, which creates the possibility of a NULL pointer dereference
soon after.  To fix, emit an ERROR if dsm_attach() returns NULL.
This shouldn't happen, but it would be nice to avoid a segfault if
it does.  In passing, tidy up the surrounding code.

Reported-by: Tom Lane
Reviewed-by: Michael Paquier, Bharath Rupireddy
Discussion: https://postgr.es/m/3348869.1705854106%40sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4372adfa24f2f5ddc587317d634b5389bd764106

Modified Files
--------------
src/backend/storage/ipc/dsm_registry.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)



view thread (2+ messages)

Message-ID: <E1rS6my-002fhV-62@gemulon.postgresql.org>
Permalink:  ../E1rS6my-002fhV-62@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rS6my-002fhV-62@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: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix possible NULL pointer dereference in GetNamedDSMSegment().
  In-Reply-To: <E1rS6my-002fhV-62@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