diff --git a/sandboxed_api/tools/clang_generator/diagnostics.cc b/sandboxed_api/tools/clang_generator/diagnostics.cc index d64cb26..a8880be 100644 --- a/sandboxed_api/tools/clang_generator/diagnostics.cc +++ b/sandboxed_api/tools/clang_generator/diagnostics.cc @@ -15,6 +15,7 @@ #include "sandboxed_api/tools/clang_generator/diagnostics.h" #include +#include #include #include "absl/status/status.h" @@ -50,8 +51,9 @@ absl::optional GetDiagnosticLocationFromStatus( if (auto payload = status.GetPayload(kSapiStatusPayload).value_or(absl::Cord()); payload.size() == sizeof(uint64_t)) { - return clang::SourceLocation::getFromRawEncoding( - *reinterpret_cast(payload.Flatten().data())); + uint64_t raw_encoding = 0; + memcpy(&raw_encoding, payload.Flatten().data(), sizeof(raw_encoding)); + return clang::SourceLocation::getFromRawEncoding(raw_encoding); } return absl::nullopt; }