From: Tom Lane Date: Tue, 15 Nov 2016 21:48:12 +0000 (-0500) Subject: Check that result tupdesc has exactly 1 column in return_next scalar case. X-Git-Tag: REL_10_BETA1~1399 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ecd1974377ffb4d6d72874ba14fcd23965b1792;p=thirdparty%2Fpostgresql.git 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. --- 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,