Skip to content

Commit 68db51d

Browse files
[Object] Fix the return type of getOffset/getSize
Header64.offset/Header64.size are uint64_t, thus we should not truncate them to unit32_t. Moreover, there are a number of places where we sum the offset and the size (e.g. in various checks in MachOUniversal.cpp), the truncation causes issues since the offset/size can perfectly fit into uint32_t, while the sum overflows. Differential revision: https://reviews.llvm.org/D69126 Test plan: make check-all llvm-svn: 375154
1 parent 31a691e commit 68db51d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/include/llvm/Object/MachOUniversal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ class MachOUniversalBinary : public Binary {
6666
else // Parent->getMagic() == MachO::FAT_MAGIC_64
6767
return Header64.cpusubtype;
6868
}
69-
uint32_t getOffset() const {
69+
uint64_t getOffset() const {
7070
if (Parent->getMagic() == MachO::FAT_MAGIC)
7171
return Header.offset;
7272
else // Parent->getMagic() == MachO::FAT_MAGIC_64
7373
return Header64.offset;
7474
}
75-
uint32_t getSize() const {
75+
uint64_t getSize() const {
7676
if (Parent->getMagic() == MachO::FAT_MAGIC)
7777
return Header.size;
7878
else // Parent->getMagic() == MachO::FAT_MAGIC_64

0 commit comments

Comments
 (0)