BUG #14927: Unchecked SearchSysCache1() return value

From: bianpan2016(at)163(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Cc: bianpan2016(at)163(dot)com
Subject: BUG #14927: Unchecked SearchSysCache1() return value
Date: 2017-11-27 09:01:05
Message-ID: 20171127090105.1463.3962@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14927
Logged by: Pan Bian
Email address: bianpan2016(at)163(dot)com
PostgreSQL version: 10.1
Operating system: Linux
Description:

File: postgresql-10.1/src/backend/catalog/heap.c
Function: heap_drop_with_catalog
Line: 1771

Function SearchSysCache1() may return a NULL pointer, but in
heap_drop_with_catalog(), its return value is not validated before it is
dereferenced. To avoid NULL dereference, it is better to check the return
value of SearchSysCache1() against NULL.

For your convenience, I paste related codes as follows:

1771 tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
1772 if (((Form_pg_class) GETSTRUCT(tuple))->relispartition)
1773 {
1774 parentOid = get_partition_parent(relid);
1775 LockRelationOid(parentOid, AccessExclusiveLock);
1776 }
1777
1778 ReleaseSysCache(tuple);

Thank you!

Pan Bian

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message bianpan2016 2017-11-27 09:13:41 BUG #14928: Unchecked SearchSysCacheCopy1() return value
Previous Message Tom Lane 2017-11-26 17:22:07 Re: Lack of information on materialized views in information_schema.table_privileges.