pgsql: Validate the OID argument of pg_import_system_collations().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Validate the OID argument of pg_import_system_collations().
Date: 2021-03-08 23:22:11
Message-ID: E1lJPCV-00048T-7r@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Validate the OID argument of pg_import_system_collations().

"SELECT pg_import_system_collations(0)" caused an assertion failure.
With a random nonzero argument --- or indeed with zero, in non-assert
builds --- it would happily make pg_collation entries with garbage
values of collnamespace. These are harmless as far as I can tell
(unless maybe the OID happens to become used for a schema, later on?).
In any case this isn't a security issue, since the function is
superuser-only. But it seems like a gotcha for unwary DBAs, so let's
add a check that the given OID belongs to some schema.

Back-patch to v10 where this function was introduced.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5c06abb9b97b69513a3998cccf89556e73052e02

Modified Files
--------------
src/backend/commands/collationcmds.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-03-08 23:55:05 pgsql: Complain if a function-in-FROM returns a set when it shouldn't.
Previous Message Tom Lane 2021-03-08 21:32:52 pgsql: Further tweak memory management for regex DFAs.