pgsql: Repair insufficiently careful type checking for SQL-language

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Repair insufficiently careful type checking for SQL-language
Date: 2007-02-02 00:03:44
Message-ID: 20070202000344.5F7CE9FB1DD@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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

Tags:
----
REL8_0_STABLE

Modified Files:
--------------
pgsql/src/backend/executor:
functions.c (r1.91.4.2 -> r1.91.4.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/functions.c.diff?r1=1.91.4.2&r2=1.91.4.3)
pgsql/src/backend/optimizer/util:
clauses.c (r1.186.4.4 -> r1.186.4.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/clauses.c.diff?r1=1.186.4.4&r2=1.186.4.5)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-02-02 00:04:02 pgsql: Repair insufficiently careful type checking for SQL-language
Previous Message Tom Lane 2007-02-02 00:03:30 pgsql: Repair insufficiently careful type checking for SQL-language