Commit c9f5cb97 authored by Monty's avatar Monty

Added checks for uninitalized memory when writing to IO_CACHE

This was done to be able to track some cases of unallocated memory
in replication tests reported by MSAN.
parent e843033d
......@@ -24,9 +24,7 @@ C_MODE_START
#include <my_valgrind.h>
#include <my_pthread.h>
#include <m_ctype.h> /* for CHARSET_INFO */
#include <stdarg.h>
#include <typelib.h>
......@@ -509,6 +507,7 @@ static inline int my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count)
static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
MEM_CHECK_DEFINED(Buffer, Count);
if (info->write_pos + Count <= info->write_end)
{
memcpy(info->write_pos, Buffer, Count);
......@@ -530,6 +529,7 @@ static inline int my_b_get(IO_CACHE *info)
static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr)
{
MEM_CHECK_DEFINED(&chr, 1);
if (info->write_pos >= info->write_end)
if (my_b_flush_io_cache(info, 1))
return 1;
......
......@@ -1566,6 +1566,8 @@ int my_b_append(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
size_t rest_length,length;
MEM_CHECK_DEFINED(Buffer, Count);
/*
Assert that we cannot come here with a shared cache. If we do one
day, we might need to add a call to copy_to_read_buffer().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment