]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Validate the OID argument of pg_import_system_collations().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 8 Mar 2021 23:21:51 +0000 (18:21 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 8 Mar 2021 23:21:51 +0000 (18:21 -0500)
commitea42ccbced4baeff9df9be0cb8ec3e4d42070089
tree3238ef4b2bb65425c56e2c8a1906d2ddfceeabac
parent25b13721d41de3d74771f02b9827aac66bc97d33
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.
src/backend/commands/collationcmds.c