[llvm] r375154 - [Object] Fix the return type of getOffset/getSize
Alexander Shaposhnikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 11:48:08 PDT 2019
Author: alexshap
Date: Thu Oct 17 11:48:07 2019
New Revision: 375154
URL: http://llvm.org/viewvc/llvm-project?rev=375154&view=rev
Log:
[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
Modified:
llvm/trunk/include/llvm/Object/MachOUniversal.h
Modified: llvm/trunk/include/llvm/Object/MachOUniversal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachOUniversal.h?rev=375154&r1=375153&r2=375154&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachOUniversal.h (original)
+++ llvm/trunk/include/llvm/Object/MachOUniversal.h Thu Oct 17 11:48:07 2019
@@ -66,13 +66,13 @@ public:
else // Parent->getMagic() == MachO::FAT_MAGIC_64
return Header64.cpusubtype;
}
- uint32_t getOffset() const {
+ uint64_t getOffset() const {
if (Parent->getMagic() == MachO::FAT_MAGIC)
return Header.offset;
else // Parent->getMagic() == MachO::FAT_MAGIC_64
return Header64.offset;
}
- uint32_t getSize() const {
+ uint64_t getSize() const {
if (Parent->getMagic() == MachO::FAT_MAGIC)
return Header.size;
else // Parent->getMagic() == MachO::FAT_MAGIC_64
More information about the llvm-commits
mailing list