diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-06-22 18:21:21 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2021-07-15 16:28:13 +0200 |
commit | a7d880f0b095939118594ecbeba953959ae8e351 (patch) | |
tree | 4bd583a11bf5fc42327bdb8b069fb7673cb54a47 /sql/net_serv.cc | |
parent | 826eab3f9b28dbc370e5d7a2f81dc42d2f09ed40 (diff) | |
download | mariadb-git-a7d880f0b095939118594ecbeba953959ae8e351.tar.gz |
MDEV-21916: COM_STMT_BULK_EXECUTE with RETURNING insert wrong values
The problem is that array binding uses net buffer to read parameters for each
execution while each execiting with RETURNING write in the same buffer.
Solution is to allocate new net buffer to avoid changing buffer we are reading
from.
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r-- | sql/net_serv.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc index a96c43a94fe..1d2409f16cf 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -179,14 +179,26 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags) DBUG_RETURN(0); } + +/** + Allocate and assign new net buffer + + @note In case of error the old buffer left + + @retval TRUE error + @retval FALSE success +*/ + my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags) { + uchar *tmp; DBUG_ENTER("net_allocate_new_packet"); - if (!(net->buff=(uchar*) my_malloc(key_memory_NET_buff, - (size_t) net->max_packet + - NET_HEADER_SIZE + COMP_HEADER_SIZE + 1, - MYF(MY_WME | my_flags)))) + if (!(tmp= (uchar*) my_malloc(key_memory_NET_buff, + (size_t) net->max_packet + + NET_HEADER_SIZE + COMP_HEADER_SIZE + 1, + MYF(MY_WME | my_flags)))) DBUG_RETURN(1); + net->buff= tmp; net->buff_end=net->buff+net->max_packet; net->write_pos=net->read_pos = net->buff; DBUG_RETURN(0); |