diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-06-23 15:14:22 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-06-30 13:28:28 +0200 |
commit | b503b1c0edaa976e90b9bf3339677a710752e58a (patch) | |
tree | 44e324e1b504647c29a0400206703d4a535b50fe /sql/table.cc | |
parent | a1e51e7f479cab7f46c12d0c488a6b310ae64807 (diff) | |
download | mariadb-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/table.cc')
-rw-r--r-- | sql/table.cc | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/sql/table.cc b/sql/table.cc index a1e9ebfc0cc..3ab89897e07 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4150,16 +4150,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl) DBUG_ASSERT(key_read == 0); - /* mark the record[0] uninitialized */ - TRASH(record[0], s->reclength); - - /* - Initialize the null marker bits, to ensure that if we are doing a read - of only selected columns (like in keyread), all null markers are - initialized. - */ - memset(record[0], 255, s->null_bytes); - memset(record[1], 255, s->null_bytes); + restore_record(this, s->default_values); /* Tables may be reused in a sub statement. */ DBUG_ASSERT(!file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN)); |