diff --git a/sandboxed_api/BUILD.bazel b/sandboxed_api/BUILD.bazel index 63f4ef3..0a6fa5d 100644 --- a/sandboxed_api/BUILD.bazel +++ b/sandboxed_api/BUILD.bazel @@ -86,6 +86,7 @@ cc_library( "//sandboxed_api/util:status", "@com_google_absl//absl/base", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/base:dynamic_annotations", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/memory", "@com_google_absl//absl/status", diff --git a/sandboxed_api/CMakeLists.txt b/sandboxed_api/CMakeLists.txt index a023d86..220aae8 100644 --- a/sandboxed_api/CMakeLists.txt +++ b/sandboxed_api/CMakeLists.txt @@ -75,7 +75,8 @@ add_library(sapi_sapi ${SAPI_LIB_TYPE} ) add_library(sapi::sapi ALIAS sapi_sapi) target_link_libraries(sapi_sapi - PRIVATE absl::flat_hash_map + PRIVATE absl::dynamic_annotations + absl::flat_hash_map absl::memory absl::status absl::statusor diff --git a/sandboxed_api/client.cc b/sandboxed_api/client.cc index ab8c5ec..320e053 100644 --- a/sandboxed_api/client.cc +++ b/sandboxed_api/client.cc @@ -396,6 +396,8 @@ void ServeRequest(sandbox2::Comms* comms) { } if (ret.ret_type == v::Type::kFloat) { + // Make MSAN happy with long double. + ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&ret.float_val, sizeof(ret.float_val)); VLOG(1) << "Returned value: " << ret.float_val << ", Success: " << (ret.success ? "Yes" : "No"); } else { diff --git a/sandboxed_api/sandbox.cc b/sandboxed_api/sandbox.cc index 3f51f4c..08fd07a 100644 --- a/sandboxed_api/sandbox.cc +++ b/sandboxed_api/sandbox.cc @@ -24,6 +24,7 @@ #include #include "absl/base/casts.h" +#include "absl/base/dynamic_annotations.h" #include "absl/base/macros.h" #include "absl/memory/memory.h" #include "absl/status/status.h" @@ -323,6 +324,9 @@ absl::Status Sandbox::Call(const std::string& func, v::Callable* ret, if (arg->GetType() == v::Type::kFloat) { arg->GetDataFromPtr(&rfcall.args[i].arg_float, sizeof(rfcall.args[0].arg_float)); + // Make MSAN happy with long double. + ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&rfcall.args[i].arg_float, + sizeof(rfcall.args[0].arg_float)); } else { arg->GetDataFromPtr(&rfcall.args[i].arg_int, sizeof(rfcall.args[0].arg_int)); diff --git a/sandboxed_api/var_reg.h b/sandboxed_api/var_reg.h index bc46e6f..3cf3661 100644 --- a/sandboxed_api/var_reg.h +++ b/sandboxed_api/var_reg.h @@ -57,9 +57,7 @@ class Reg : public Callable { "Only register-sized types are allowed as template argument " "for class Reg."); - Reg() : Reg(static_cast(0)) {} - - explicit Reg(const T val) { + explicit Reg(const T val = {}) { val_ = val; SetLocal(&val_); }