Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4ecd197

Browse files
committed
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.
1 parent b40b4dd commit 4ecd197

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/pl/tcl/pltcl.c

+4
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,10 @@ pltcl_returnnext(ClientData cdata, Tcl_Interp *interp,
21922192
Datum retval;
21932193
bool isNull = false;
21942194

2195+
/* for paranoia's sake, check that tupdesc has exactly one column */
2196+
if (call_state->ret_tupdesc->natts != 1)
2197+
elog(ERROR, "wrong result type supplied in return_next");
2198+
21952199
retval = InputFunctionCall(&prodesc->result_in_func,
21962200
utf_u2e((char *) Tcl_GetString(objv[1])),
21972201
prodesc->result_typioparam,

0 commit comments

Comments
 (0)