mirror of
https://github.com/MariaDB/server.git
synced 2026-04-25 09:45:31 +02:00
BUG#20498: Wrong usage of hash_first() in get_open_table().
The get_open_table() function was using the wrong key for hash lookups. This could potentially lead to unpredictable behaviour. sql/ha_ndbcluster.cc: BUG#20498: Wrong usage of hash_first() in get_open_table().
This commit is contained in:
parent
9b402b909b
commit
78deb348f0
1 changed files with 3 additions and 3 deletions
|
|
@ -317,7 +317,7 @@ byte *thd_ndb_share_get_key(THD_NDB_SHARE *thd_ndb_share, uint *length,
|
|||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*length= sizeof(thd_ndb_share->key);
|
||||
return (byte*) thd_ndb_share->key;
|
||||
return (byte*) &thd_ndb_share->key;
|
||||
}
|
||||
|
||||
Thd_ndb::Thd_ndb()
|
||||
|
|
@ -371,9 +371,9 @@ Thd_ndb::get_open_table(THD *thd, const void *key)
|
|||
DBUG_ENTER("Thd_ndb::get_open_table");
|
||||
HASH_SEARCH_STATE state;
|
||||
THD_NDB_SHARE *thd_ndb_share=
|
||||
(THD_NDB_SHARE*)hash_first(&open_tables, (byte *)key, sizeof(key), &state);
|
||||
(THD_NDB_SHARE*)hash_first(&open_tables, (byte *)&key, sizeof(key), &state);
|
||||
while (thd_ndb_share && thd_ndb_share->key != key)
|
||||
thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)key, sizeof(key), &state);
|
||||
thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)&key, sizeof(key), &state);
|
||||
if (thd_ndb_share == 0)
|
||||
{
|
||||
thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue