aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/commit_ts.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-08-21 12:21:37 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-08-21 12:21:37 -0400
commit19446280fce0b9aebef40c6b5390cf1170c5c770 (patch)
tree2d0951bd23c55f0337b9d684274b3baf426e62a1 /src/backend/access/transam/commit_ts.c
parent20bef3fe2ed180c64a5140b8ebeba439afd1bb95 (diff)
downloadpostgresql-19446280fce0b9aebef40c6b5390cf1170c5c770.tar.gz
postgresql-19446280fce0b9aebef40c6b5390cf1170c5c770.zip
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.
Diffstat (limited to 'src/backend/access/transam/commit_ts.c')
0 files changed, 0 insertions, 0 deletions