summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-06-23 15:14:22 +0200
committerSergei Golubchik <serg@mariadb.org>2017-06-30 13:28:28 +0200
commitb503b1c0edaa976e90b9bf3339677a710752e58a (patch)
tree44e324e1b504647c29a0400206703d4a535b50fe /sql/sql_insert.cc
parenta1e51e7f479cab7f46c12d0c488a6b310ae64807 (diff)
downloadmariadb-git-b503b1c0edaa976e90b9bf3339677a710752e58a.tar.gz
MDEV-11646 main.myisam, maria.maria, main.mix2_myisam, main.myisampack, main.mrr_icp_extra fail in buildbot with valgrind (Syscall param pwrite64(buf) points to uninitialised byte(s))
If the table has a varchar column and a forced fixed for format (as in varchar.inc), Field_varstring::store() will only store the actual number of bytes, not padded, in the record[0]. That is, on inserts a part of record[0] can be uninitialized. Fix: initialize record[0] when a TABLE is created, it doesn't matter what kind of garbage can be in this unused/invisible part of the record, as long as it's not some random memory contents (that can contain sensitive data).
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc7
1 files changed, 1 insertions, 6 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 88eb76ef1ed..e750e97194a 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -970,12 +970,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
be overwritten by fill_record() anyway (and fill_record() does not
use default values in this case).
*/
-#ifdef HAVE_valgrind
- if (table->file->ha_table_flags() && HA_RECORD_MUST_BE_CLEAN_ON_WRITE)
- restore_record(table,s->default_values); // Get empty record
- else
-#endif
- table->record[0][0]= share->default_values[0];
+ table->record[0][0]= share->default_values[0];
/* Fix undefined null_bits. */
if (share->null_bytes > 1 && share->last_null_bit_pos)