summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a653bf1)
raw | patch | inline | side by side (parent: a653bf1)
author | Benjamin Kramer <benny.kra@googlemail.com> | |
Fri, 24 Oct 2014 15:52:05 +0000 (15:52 +0000) | ||
committer | Benjamin Kramer <benny.kra@googlemail.com> | |
Fri, 24 Oct 2014 15:52:05 +0000 (15:52 +0000) |
This works because uuid's are always little endian so it's not swapped.
Fixes use-after-return reported by asan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220567 91177308-0d34-0410-b5e6-96231b3b80d8
Fixes use-after-return reported by asan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220567 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Object/MachOObjectFile.cpp | patch | blob | history |
index 0bd61cecb577d06f2ea5e8534ae370d358d31779..ad2fd03f9eeb60353e03a7c174d33ed09938a05b 100644 (file)
ArrayRef<uint8_t> MachOObjectFile::getUuid() const {
if (!UuidLoadCmd)
return ArrayRef<uint8_t>();
- MachO::uuid_command Uuid = getStruct<MachO::uuid_command>(this, UuidLoadCmd);
- return ArrayRef<uint8_t>(Uuid.uuid, 16);
+ // Returning a pointer is fine as uuid doesn't need endian swapping.
+ const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid);
+ return ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Ptr), 16);
}
StringRef MachOObjectFile::getStringTableData() const {