From 453152dfa858db8e30f727835409a4b1ccd8fbb1 Mon Sep 17 00:00:00 2001 From: Alexander Shaposhnikov Date: Thu, 17 Oct 2019 18:48:07 +0000 Subject: [PATCH] [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375154 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/MachOUniversal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llvm/Object/MachOUniversal.h b/include/llvm/Object/MachOUniversal.h index 490d73f4c7e..eb45aff4480 100644 --- a/include/llvm/Object/MachOUniversal.h +++ b/include/llvm/Object/MachOUniversal.h @@ -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