From: bianpan2016@163.com
To: pgsql-bugs@postgresql.org
Cc: bianpan2016@163.com
Subject: BUG #14928: Unchecked SearchSysCacheCopy1() return value
Date: Mon, 27 Nov 2017 09:13:41 +0000
Message-ID: <20171127091341.1468.72696@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 14928
Logged by: Pan Bian
Email address: bianpan2016@163.com
PostgreSQL version: 10.1
Operating system: Linux
Description:
File: postgresql-10.1/src/backend/commands/tablecmds.c
Function: ATExecDetachPartition
Line: 13816
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).
For your convenience, I copy and paste related codes as follows.
13815 classRel = heap_open(RelationRelationId, RowExclusiveLock);
13816 tuple = SearchSysCacheCopy1(RELOID,
13817
ObjectIdGetDatum(RelationGetRelid(partRel)));
13818 Assert(((Form_pg_class) GETSTRUCT(tuple))->relispartition);
13819
13820 (void) SysCacheGetAttr(RELOID, tuple,
Anum_pg_class_relpartbound,
13821 &isnull);
13822 Assert(!isnull);
Thank you!
Pan Bian
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: bianpan2016@163.com
Subject: Re: BUG #14928: Unchecked SearchSysCacheCopy1() return value
In-Reply-To: <20171127091341.1468.72696@wrigleys.postgresql.org>
References: <20171127091341.1468.72696@wrigleys.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