mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Fix unaligned load
PiperOrigin-RevId: 577106224 Change-Id: Icd0e113031d367fa30557d4e77571abc78e8e378
This commit is contained in:
parent
0940a9ee4a
commit
4630346fd1
|
@ -15,6 +15,7 @@
|
||||||
#include "sandboxed_api/tools/clang_generator/diagnostics.h"
|
#include "sandboxed_api/tools/clang_generator/diagnostics.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
|
@ -50,8 +51,9 @@ absl::optional<clang::SourceLocation> GetDiagnosticLocationFromStatus(
|
||||||
if (auto payload =
|
if (auto payload =
|
||||||
status.GetPayload(kSapiStatusPayload).value_or(absl::Cord());
|
status.GetPayload(kSapiStatusPayload).value_or(absl::Cord());
|
||||||
payload.size() == sizeof(uint64_t)) {
|
payload.size() == sizeof(uint64_t)) {
|
||||||
return clang::SourceLocation::getFromRawEncoding(
|
uint64_t raw_encoding = 0;
|
||||||
*reinterpret_cast<const uint64_t*>(payload.Flatten().data()));
|
memcpy(&raw_encoding, payload.Flatten().data(), sizeof(raw_encoding));
|
||||||
|
return clang::SourceLocation::getFromRawEncoding(raw_encoding);
|
||||||
}
|
}
|
||||||
return absl::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user