From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: bianpan2016@163.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14928: Unchecked SearchSysCacheCopy1() return value
Date: Mon, 27 Nov 2017 19:25:49 -0500
Message-ID: <19181.1511828749@sss.pgh.pa.us> (raw)
In-Reply-To: <85682287-8cdb-03d5-94d3-2b722e3ce968@lab.ntt.co.jp>
References: <20171127091341.1468.72696@wrigleys.postgresql.org>
<85682287-8cdb-03d5-94d3-2b722e3ce968@lab.ntt.co.jp>
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
> On 2017/11/27 18:13, bianpan2016@163.com wrote:
>> Function SearchSysCacheCopy1() may return a NULL pointer if there is no
>> enough memory. But in function ATExecDetachPartition(), its return value is
>> not checked, which may result in NULL dereference (see line 13818).
> Thanks for the report. Attached a patch that adds a check that tuple is
> valid before trying to dereference it.
Pushed. Checking other SearchSysCache calls in these two files, I noted
a third instance of the same problem in StorePartitionKey(). However,
looking closer, StorePartitionKey never does anything at all with the
result of its SearchSysCache1(PARTRELID, ...) lookup, including never
releasing the syscache reference. How is it that we don't get refcount
leak warnings? I guess that must prove that that lookup always fails,
which is not too surprising since it seems to be against the partition
key info that we haven't stored yet. Anyway, I just diked that one
out, since it's clearly useless.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, Langote_Amit_f8@lab.ntt.co.jp, bianpan2016@163.com
Subject: Re: BUG #14928: Unchecked SearchSysCacheCopy1() return value
In-Reply-To: <19181.1511828749@sss.pgh.pa.us>
References: <20171127091341.1468.72696@wrigleys.postgresql.org> <85682287-8cdb-03d5-94d3-2b722e3ce968@lab.ntt.co.jp> <19181.1511828749@sss.pgh.pa.us>
* 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