MXS-2324: Prevent stack overflow with large results
If a result consists of only OK packets, they would be processed recursively which most of the time leads to a stack overflow. This can be prevented by consuming all OK packets in the result in one go.
This commit is contained in:
parent
a6f52b008f
commit
0b77c3f05f
@ -192,6 +192,14 @@ void RWBackend::process_reply(GWBUF* buffer)
|
||||
// TODO: Don't clone the buffer
|
||||
GWBUF* tmp = gwbuf_clone(buffer);
|
||||
tmp = gwbuf_consume(tmp, mxs_mysql_get_packet_len(tmp));
|
||||
|
||||
// Consume repeating OK packets
|
||||
while (mxs_mysql_more_results_after_ok(buffer) && have_next_packet(tmp))
|
||||
{
|
||||
tmp = gwbuf_consume(tmp, mxs_mysql_get_packet_len(tmp));
|
||||
mxb_assert(tmp);
|
||||
}
|
||||
|
||||
process_reply(tmp);
|
||||
gwbuf_free(tmp);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user