Add MSAN support with a functional test. PiperOrigin-RevId: 800008865
diff --git a/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc b/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc index 1282a92..f1c7d63 100644 --- a/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc +++ b/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc
@@ -27,6 +27,7 @@ #include <array> #include <cmath> #include <cstdint> +#include <cstdio> #include <cstdlib> #include <optional> #include <string> @@ -87,6 +88,15 @@ } FUZZ_TEST(MySuite, DereferenceEmptyOptional); +// We use this test to make sure we catch reading uninitialized memory. +void UninitializedReadWithString(const std::string& s) { + if (s.empty()) return; + volatile uint8_t uninitialized_memory[1]; + printf("Read byte %x\n", uninitialized_memory[0]); +} +FUZZ_TEST(MySuite, UninitializedReadWithString) + .WithDomains(fuzztest::Arbitrary<std::string>()); + // Always disable optimization for this example, otherwise (when optimization is // enabled) SanCov doesn't instrument all edges (and therefore no feedback). // TODO(b/182297432): Make this unnecessary.