diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp --- a/compiler-rt/lib/msan/msan.cpp +++ b/compiler-rt/lib/msan/msan.cpp @@ -527,6 +527,9 @@ sptr __msan_test_shadow(const void *x, uptr size) { if (!MEM_IS_APP(x)) return -1; unsigned char *s = (unsigned char *)MEM_TO_SHADOW((uptr)x); + if (__sanitizer::mem_is_zero((const char *)s, size)) + return -1; + // Slow path: loop through again to find the location. for (uptr i = 0; i < size; ++i) if (s[i]) return i;