mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 15:45:33 +02:00
Added detection of memory overwrite with multi_malloc
This patch also fixes some bugs detected by valgrind after this patch: - Not enough copy_func elements was allocated by Create_tmp_table() which causes an memory overwrite in Create_tmp_table::add_fields() I added an ASSERT() to be able to detect this also without valgrind. The bug was that TMP_TABLE_PARAM::copy_fields was not correctly set when calling create_tmp_table(). - Aria::empty_bits is not allocated if there is no varchar/char/blob fields in the table. Fixed code to take this into account. This cannot cause any issues as this is just a memory access into other Aria memory and the content of the memory would not be used. - Aria::last_key_buff was not allocated big enough. This may have caused issues with rtrees and ma_extra(HA_EXTRA_REMEMBER_POS) as they would use the same memory area. - Aria and MyISAM didn't take extended key parts into account, which caused problems when copying rec_per_key from engine to sql level. - Mark asan builds with 'asan' in version strihng to detect these in not_valgrind_build.inc. This is needed to not have main.sp-no-valgrind fail with asan.
This commit is contained in:
parent
0de3be8cfd
commit
57c526ffb8
18 changed files with 136 additions and 58 deletions
|
|
@ -912,9 +912,8 @@ bool THD::has_temporary_tables()
|
|||
uint THD::create_tmp_table_def_key(char *key, const char *db,
|
||||
const char *table_name)
|
||||
{
|
||||
DBUG_ENTER("THD::create_tmp_table_def_key");
|
||||
|
||||
uint key_length;
|
||||
DBUG_ENTER("THD::create_tmp_table_def_key");
|
||||
|
||||
key_length= tdc_create_key(key, db, table_name);
|
||||
int4store(key + key_length, variables.server_id);
|
||||
|
|
@ -1163,11 +1162,10 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
|
|||
*/
|
||||
bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, TABLE **out_table)
|
||||
{
|
||||
DBUG_ENTER("THD::find_and_use_tmp_table");
|
||||
|
||||
char key[MAX_DBKEY_LENGTH];
|
||||
uint key_length;
|
||||
bool result;
|
||||
DBUG_ENTER("THD::find_and_use_tmp_table");
|
||||
|
||||
key_length= create_tmp_table_def_key(key, tl->get_db_name(),
|
||||
tl->get_table_name());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue