1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-27 22:56:53 +03:00

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.
This commit is contained in:
Tom Lane 2016-11-15 16:48:12 -05:00
parent b40b4dd9e1
commit 4ecd197437

View File

@ -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,