Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 9a8a815

Browse files
committed
Make 32-bit member offset in Archive::Symbol::getMember 64-bit
When accessing a member for a symbol with an offset greater than 2^32 - 1 the current Archive::Symbol::getMember implementation will overflow and cause unexpected behavior. This change simply fixes that. In particular if you call "llvm-nm --print-armap" on an archive that has this behavior you'll get an error. Differential Revision: https://reviews.llvm.org/D39379 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316801 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6861d89 commit 9a8a815

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Object/Archive.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ Expected<Archive::Child> Archive::Symbol::getMember() const {
801801
Offsets += sizeof(uint64_t);
802802
else
803803
Offsets += sizeof(uint32_t);
804-
uint32_t Offset = 0;
804+
uint64_t Offset = 0;
805805
if (Parent->kind() == K_GNU) {
806806
Offset = read32be(Offsets + SymbolIndex * 4);
807807
} else if (Parent->kind() == K_GNU64) {

0 commit comments

Comments
 (0)