mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
[Object] Fix MachO's getUuid to return a pointer into the object instead of a dangling ArrayRef.
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
This commit is contained in:
parent
a653bf1b12
commit
5ea04462dc
@ -2460,8 +2460,9 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user