summaryrefslogtreecommitdiff
path: root/strings/my_vsnprintf.c
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-03-14 09:28:55 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-03-14 09:28:55 +0200
commit59359fb44a6ddbed5d8d5487ec62da43db763299 (patch)
treea99f6d12e0350c89d2f629d8ee67ea0e14817c71 /strings/my_vsnprintf.c
parentd78173828e9f69ab3f6a406cb38f323261171076 (diff)
downloadmariadb-git-59359fb44a6ddbed5d8d5487ec62da43db763299.tar.gz
MDEV-24841 Build error with MSAN use-of-uninitialized-value in comp_err
The MemorySanitizer implementation in clang includes some built-in instrumentation (interceptors) for GNU libc. In GNU libc 2.33, the interface to the stat() family of functions was changed. Until the MemorySanitizer interceptors are adjusted, any MSAN code builds will act as if that the stat() family of functions failed to initialize the struct stat. A fix was applied in https://reviews.llvm.org/rG4e1a6c07052b466a2a1cd0c3ff150e4e89a6d87a but it fails to cover the 64-bit variants of the calls. For now, let us work around the MemorySanitizer bug by defining and using the macro MSAN_STAT_WORKAROUND().
Diffstat (limited to 'strings/my_vsnprintf.c')
-rw-r--r--strings/my_vsnprintf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index a2e3f9b738d..8b4dc5da561 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -704,10 +704,11 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
}
else if (*fmt == 'f' || *fmt == 'g')
{
+ double d;
#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);
+ d= va_arg(ap, double);
#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
__msan_unpoison(&d, sizeof(double));
#endif