]> granicus.if.org Git - postgresql/commit
Repair insufficiently careful type checking for SQL-language functions:
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Feb 2007 00:04:16 +0000 (00:04 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Feb 2007 00:04:16 +0000 (00:04 +0000)
commit6be54294cbfb548a4d0ba1284dc83d2a0c88ca3e
tree69791bcc26396dfda36e97741d3bd8e0e1446977
parentcf9ca3d2a3fa7bdc6147673a433469669a20a903
Repair insufficiently careful type checking for SQL-language functions:
we should check that the function code returns the claimed result datatype
every time we parse the function for execution.  Formerly, for simple
scalar result types we assumed the creation-time check was sufficient, but
this fails if the function selects from a table that's been redefined since
then, and even more obviously fails if check_function_bodies had been OFF.

This is a significant security hole: not only can one trivially crash the
backend, but with appropriate misuse of pass-by-reference datatypes it is
possible to read out arbitrary locations in the server process's memory,
which could allow retrieving database content the user should not be able
to see.  Our thanks to Jeff Trout for the initial report.

Security: CVE-2007-0555
src/backend/catalog/pg_proc.c
src/backend/executor/functions.c
src/include/catalog/pg_proc.h