[PATCH] D39379: Make 32-bit member offset in Symbol::getMember 64-bit

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 11:46:28 PDT 2017


jakehehrlich created this revision.

When accessing a member for a symbol with an offset greater than 2^32 - 1 the current Symbol::getMember implementation will overflow and cause unexpected behavior. This change simply fixes that.


Repository:
  rL LLVM

https://reviews.llvm.org/D39379

Files:
  lib/Object/Archive.cpp


Index: lib/Object/Archive.cpp
===================================================================
--- lib/Object/Archive.cpp
+++ lib/Object/Archive.cpp
@@ -801,7 +801,7 @@
     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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39379.120665.patch
Type: text/x-patch
Size: 424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171027/1d3cc88e/attachment.bin>


More information about the llvm-commits mailing list