diff options
author | Jake Ehrlich <jakehehrlich@google.com> | 2017-10-27 21:47:38 +0000 |
---|---|---|
committer | Jake Ehrlich <jakehehrlich@google.com> | 2017-10-27 21:47:38 +0000 |
commit | de370414e3820a3816e6c53c1d95603f5ace3357 (patch) | |
tree | 109f73d9cf64288f001f9776c675fe89df21f5cb /llvm/lib/Object/Archive.cpp | |
parent | 4ab13cda813ef15f3254b68b8c22bdaa76732ad1 (diff) | |
download | llvm-de370414e3820a3816e6c53c1d95603f5ace3357.zip llvm-de370414e3820a3816e6c53c1d95603f5ace3357.tar.gz llvm-de370414e3820a3816e6c53c1d95603f5ace3357.tar.bz2 |
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
llvm-svn: 316801
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r-- | llvm/lib/Object/Archive.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index 20aaa1f..b17eefd 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -801,7 +801,7 @@ Expected<Archive::Child> Archive::Symbol::getMember() const { 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) { |