[llvm] r316801 - Make 32-bit member offset in Archive::Symbol::getMember 64-bit
Jake Ehrlich via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 14:47:38 PDT 2017
Author: jakehehrlich
Date: Fri Oct 27 14:47:38 2017
New Revision: 316801
URL: http://llvm.org/viewvc/llvm-project?rev=316801&view=rev
Log:
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
Modified:
llvm/trunk/lib/Object/Archive.cpp
Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=316801&r1=316800&r2=316801&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Fri Oct 27 14:47:38 2017
@@ -801,7 +801,7 @@ Expected<Archive::Child> Archive::Symbol
Offsets += sizeof(uint64_t);
else
Offsets += sizeof(uint32_t);
- uint32_t Offset = 0;
+ uint64_t Offset = 0;
if (Parent->kind() == K_GNU) {
Offset = read32be(Offsets + SymbolIndex * 4);
} else if (Parent->kind() == K_GNU64) {
More information about the llvm-commits
mailing list