Commit e843033d authored by Monty's avatar Monty

Created a workaround for a bug in MSAN for va_arg(,double)

MDEV-22691 MSAN use-of-uninitialized-value in test maria.maria-recovery2

This caused all my_vsnprintf() using doubles to fail.
Thanks to the workaround, I was able to remove the disabling of
MSAN in dtoa().
parent d7a9cdc6
......@@ -2168,9 +2168,6 @@ static int quorem(Bigint *b, Bigint *S)
static char *dtoa(double dd, int mode, int ndigits, int *decpt, int *sign,
char **rve, char *buf, size_t buf_size)
#if __has_feature(memory_sanitizer)
__attribute__((no_sanitize("memory"))) // FIXME: dd is claimed uninitialized
#endif
{
/*
Arguments ndigits, decpt, sign are similar to those
......
......@@ -704,7 +704,13 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
}
else if (*fmt == 'f' || *fmt == 'g')
{
#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
__msan_check_mem_is_initialized(ap, sizeof(double));
#endif
double d= va_arg(ap, double);
#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
__msan_unpoison(&d, sizeof(double));
#endif
to= process_dbl_arg(to, end, width, d, *fmt);
continue;
}
......
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