postgresql/src
Tom Lane f469f634ad Fix plpython crash when returning string representation of a RECORD result.
PLyString_ToComposite() blithely overwrote proc->result.out.d, even though
for a composite result type the other union variant proc->result.out.r is
the one that should be valid.  This could result in a crash if out.r had
in fact been filled in (proc->result.is_rowtype == 1) and then somebody
later attempted to use that data; as per bug #13579 from Paweł Michalak.

Just to add insult to injury, it didn't work for RECORD results anyway,
because record_in() would refuse the case.

Fix by doing the I/O function lookup in a local PLyTypeInfo variable,
as we were doing already in PLyObject_ToComposite().  This is not a great
technique because any fn_extra data allocated by the input function will
be leaked permanently (thanks to using TopMemoryContext as fn_mcxt).
But that's a pre-existing issue that is much less serious than a crash,
so leave it to be fixed separately.

This bug would be a potential security issue, except that plpython is
only available to superusers and the crash requires coding the function
in a way that didn't work before today's patches.

Add regression test cases covering all the supported methods of converting
composite results.

Back-patch to 9.1 where the faulty coding was introduced.
2015-08-21 12:21:37 -04:00
..
backend Allow record_in() and record_recv() to work for transient record types. 2015-08-21 11:19:33 -04:00
bin psql: Make EXECUTE PROCEDURE tab completion a bit narrower. 2015-08-18 12:50:09 -04:00
common pgindent run for 9.5 2015-05-23 21:35:49 -04:00
include Rename 'cmd' to 'cmd_name' in CreatePolicyStmt 2015-08-21 08:22:22 -04:00
interfaces Fix declaration of isarray variable. 2015-08-13 13:23:58 +02:00
makefiles Link $(WIN32RES) into single-file modules only when PGFILEDESC is set. 2015-08-05 20:43:07 -04:00
pl Fix plpython crash when returning string representation of a RECORD result. 2015-08-21 12:21:37 -04:00
port Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
template Attempt to work around a 32bit xlc compiler bug from a different place. 2015-08-08 01:19:02 +02:00
test In AlterRole, make bypassrls an int 2015-08-21 08:22:22 -04:00
timezone
tools MSVC: Exclude 'brin' contrib module 2015-08-13 19:28:54 -03:00
tutorial Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
.gitignore
bcc32.mak
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile
Makefile.global.in Consolidate makefile code for setting top_srcdir, srcdir and VPATH. 2015-07-30 20:48:41 -04:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
nls-global.mk
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00