aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-11-15 16:48:12 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-11-15 16:48:19 -0500
commit4ecd1974377ffb4d6d72874ba14fcd23965b1792 (patch)
treec093889aca6aab232796496c08d6f9be369daad5 /src
parentb40b4dd9e10ea701c8d47ccba9407fc32ed384e5 (diff)
downloadpostgresql-4ecd1974377ffb4d6d72874ba14fcd23965b1792.tar.gz
postgresql-4ecd1974377ffb4d6d72874ba14fcd23965b1792.zip
Check that result tupdesc has exactly 1 column in return_next scalar case.
This should always be true, but since we're relying on a tuple descriptor passed from outside pltcl itself, let's check. Per a gripe from Coverity.
Diffstat (limited to 'src')
-rw-r--r--src/pl/tcl/pltcl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index b0d9e419bb9..5cb4ee85e00 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -2192,6 +2192,10 @@ pltcl_returnnext(ClientData cdata, Tcl_Interp *interp,
Datum retval;
bool isNull = false;
+ /* for paranoia's sake, check that tupdesc has exactly one column */
+ if (call_state->ret_tupdesc->natts != 1)
+ elog(ERROR, "wrong result type supplied in return_next");
+
retval = InputFunctionCall(&prodesc->result_in_func,
utf_u2e((char *) Tcl_GetString(objv[1])),
prodesc->result_typioparam,