summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-07-02 16:52:13 +0300
committerMonty <monty@mariadb.org>2020-07-02 17:59:28 +0300
commitb6ec1e8bbf0ffca2d715aded694722e0c4b5d484 (patch)
tree50a26d45267de2570fe0761f1776aa1397252c93 /sql
parent65f831d17c84900c1faea49164688e2f5ce59563 (diff)
downloadmariadb-git-b6ec1e8bbf0ffca2d715aded694722e0c4b5d484.tar.gz
MDEV-20377 post-fix: Introduce MEM_MAKE_ADDRESSABLE
In AddressSanitizer, we only want memory poisoning to happen in connection with custom memory allocation or freeing. The primary use of MEM_UNDEFINED is for declaring memory uninitialized in Valgrind or MemorySanitizer. We do not want MEM_UNDEFINED to have the unwanted side effect that AddressSanitizer would no longer be able to complain about accessing unallocated memory. MEM_UNDEFINED(): Define as no-op for AddressSanitizer. MEM_MAKE_ADDRESSABLE(): Define as MEM_UNDEFINED() or ASAN_UNPOISON_MEMORY_REGION(). MEM_CHECK_ADDRESSABLE(): Wrap also __asan_region_is_poisoned().
Diffstat (limited to 'sql')
-rw-r--r--sql/table.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index ec2d86e232e..7aa7abfa006 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1644,6 +1644,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
share->rec_buff_length= rec_buff_length;
if (!(record= (uchar *) alloc_root(&share->mem_root, rec_buff_length)))
goto err; /* purecov: inspected */
+ /* Mark bytes after record as not accessable to catch overrun bugs */
MEM_NOACCESS(record + share->reclength, rec_buff_length - share->reclength);
share->default_values= record;
memcpy(record, frm_image + record_offset, share->reclength);