pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Subject: forgotten initalization of a variable
Date: Tue, 21 Apr 2020 15:08:30 +0900 (JST)
Message-ID: <20200421.150830.1410714948345179794.horikyota.ntt@gmail.com> (raw)

Hello.

The commit a7e8ece41c adds a new member restoreCommand to
XLogPageReadPrivate. readOneRecord doesn't make use of it but forgets
to set NULL. That can lead to illegal pointer access.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

0001-Properly-initalize-a-variable.patch (text/x-patch, 957B) download From 2260cf859ffa570639fd0b04cc94540a937e6042 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyoga.ntt@gmail.com> Date: Tue, 21 Apr 2020 14:15:39 +0900 Subject: [PATCH] Properly initalize a variable. Commit a7e8ece41c adds new member restoreCommand to XLogPageReadPrivate, but forgot to initialize it with NULL in readOneRecord. That leads to illegal pointer access in SimpleXLogPageRead. --- src/bin/pg_rewind/parsexlog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c index 14a5db5433..542160c493 100644 --- a/src/bin/pg_rewind/parsexlog.c +++ b/src/bin/pg_rewind/parsexlog.c @@ -115,6 +115,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex) XLogRecPtr endptr; private.tliIndex = tliIndex; + private.restoreCommand = NULL; xlogreader = XLogReaderAllocate(WalSegSz, datadir, &SimpleXLogPageRead, &private); if (xlogreader == NULL) -- 2.18.2

view thread (5+ messages)  latest in thread

Message-ID: <20200421.150830.1410714948345179794.horikyota.ntt@gmail.com>
Permalink:  ../20200421.150830.1410714948345179794.horikyota.ntt@gmail.com/
Also on:    postgresql.org/message-id/20200421.150830.1410714948345179794.horikyota.ntt@gmail.com

 ·  · 

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-hackers@postgresql.org
  Cc: horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: forgotten initalization of a variable
  In-Reply-To: <20200421.150830.1410714948345179794.horikyota.ntt@gmail.com>

* 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