RCAP_TYPE_STMT_OUTPUT needs complete packets

It was possible that a null buffer was passed to clientReply if the
RCAP_TYPE_STMT_OUTPUT capability was needed and a partial packet was read.
This commit is contained in:
Markus Mäkelä 2019-12-14 10:36:56 +02:00
parent 78cc8f17b3
commit a1009824a6
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -839,6 +839,7 @@ static int gw_read_and_write(DCB* dcb)
MySQLProtocol* proto = (MySQLProtocol*)dcb->protocol;
if (rcap_type_required(capabilities, RCAP_TYPE_PACKET_OUTPUT)
|| rcap_type_required(capabilities, RCAP_TYPE_STMT_OUTPUT)
|| rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_OUTPUT)
|| proto->collect_result
|| proto->ignore_replies != 0)
@ -1039,6 +1040,7 @@ static int gw_read_and_write(DCB* dcb)
&& !rcap_type_required(capabilities, RCAP_TYPE_RESULTSET_OUTPUT))
{
stmt = modutil_get_next_MySQL_packet(&read_buffer);
mxb_assert_message(stmt, "There should be only complete packets in read_buffer");
if (stmt && !GWBUF_IS_CONTIGUOUS(stmt))
{