postgresql/src
Tom Lane f8ace5477e Fix type-safety problem with parallel aggregate serial/deserialization.
The original specification for this called for the deserialization function
to have signature "deserialize(serialtype) returns transtype", which is a
security violation if transtype is INTERNAL (which it always would be in
practice) and serialtype is not (which ditto).  The patch blithely overrode
the opr_sanity check for that, which was sloppy-enough work in itself,
but the indisputable reason this cannot be allowed to stand is that CREATE
FUNCTION will reject such a signature and thus it'd be impossible for
extensions to create parallelizable aggregates.

The minimum fix to make the signature type-safe is to add a second, dummy
argument of type INTERNAL.  But to lock it down a bit more and make misuse
of INTERNAL-accepting functions less likely, let's get rid of the ability
to specify a "serialtype" for an aggregate and just say that the only
useful serialtype is BYTEA --- which, in practice, is the only interesting
value anyway, due to the usefulness of the send/recv infrastructure for
this purpose.  That means we only have to allow "serialize(internal)
returns bytea" and "deserialize(bytea, internal) returns internal" as
the signatures for these support functions.

In passing fix bogus signature of int4_avg_combine, which I found thanks
to adding an opr_sanity check on combinefunc signatures.

catversion bump due to removing pg_aggregate.aggserialtype and adjusting
signatures of assorted built-in functions.

David Rowley and Tom Lane

Discussion: <27247.1466185504@sss.pgh.pa.us>
2016-06-22 16:52:41 -04:00
..
backend Fix type-safety problem with parallel aggregate serial/deserialization. 2016-06-22 16:52:41 -04:00
bin Fix type-safety problem with parallel aggregate serial/deserialization. 2016-06-22 16:52:41 -04:00
common pgindent run for 9.6 2016-06-09 18:02:36 -04:00
fe_utils Fix comment. 2016-05-15 17:04:01 -04:00
include Fix type-safety problem with parallel aggregate serial/deserialization. 2016-06-22 16:52:41 -04:00
interfaces Translation updates 2016-06-20 09:48:08 -04:00
makefiles Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
pl Add missing check for malloc failure in plpgsql_extra_checks_check_hook(). 2016-06-20 15:36:54 -04:00
port pgindent run for 9.6 2016-06-09 18:02:36 -04:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Fix type-safety problem with parallel aggregate serial/deserialization. 2016-06-22 16:52:41 -04:00
timezone Update time zone data files to tzdata release 2016d. 2016-05-05 20:08:58 -04:00
tools Add integrity-checking functions to pg_visibility. 2016-06-15 14:33:58 -04:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
Makefile.global.in Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00