pgsql: Add an Assert that enum_cmp_internal() gets passed an FmgrInfo p

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add an Assert that enum_cmp_internal() gets passed an FmgrInfo p
Date: 2017-02-24 03:08:44
Message-ID: E1ch6FQ-0002Fy-Pf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add an Assert that enum_cmp_internal() gets passed an FmgrInfo pointer.

If someone were to try to call one of the enum comparison functions
using DirectFunctionCallN, it would very likely seem to work, because
only in unusual cases does enum_cmp_internal() need to access the
typcache. But once such a case occurred, code like that would crash
with a null pointer dereference. To make an oversight of that sort
less likely to escape detection, add a non-bypassable Assert that
fcinfo->flinfo isn't NULL.

Discussion: https://postgr.es/m/25226.1487900067@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6d493e1a013514a6f0abb5d30d08219c1831cfec

Modified Files
--------------
src/backend/utils/adt/enum.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2017-02-24 06:53:51 pgsql: Make tablesample work with partitioned tables.
Previous Message Tom Lane 2017-02-23 20:57:18 pgsql: Consistently declare timestamp variables as TimestampTz.