summaryrefslogtreecommitdiff
path: root/strings/my_vsnprintf.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-06-11 13:51:36 +0300
committerMonty <monty@mariadb.org>2020-06-14 19:39:43 +0300
commite843033d0233927b8f51d7dbe21993bdfb01ecdf (patch)
tree673073c3c8ea1d24eb4e9080c02ee76686e4844b /strings/my_vsnprintf.c
parentd7a9cdc627e59b3dbb91c8878ab74d62e0fdb3ce (diff)
downloadmariadb-git-e843033d0233927b8f51d7dbe21993bdfb01ecdf.tar.gz
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().
Diffstat (limited to 'strings/my_vsnprintf.c')
-rw-r--r--strings/my_vsnprintf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index b1ba00c6aca..a2e3f9b738d 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -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;
}