[PATCH] D38020: [COFF] Adjust secrel limit check

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 17:19:07 PDT 2017


smeenai updated this revision to Diff 115934.
smeenai added a comment.

Bail out of function in case of error


https://reviews.llvm.org/D38020

Files:
  COFF/Chunks.cpp


Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -62,7 +62,10 @@
     fatal("SECREL relocation cannot be applied to absolute symbols");
   }
   uint64_t SecRel = S - OS->getRVA();
-  assert(SecRel < INT32_MAX && "overflow in SECREL relocation");
+  if (SecRel > UINT32_MAX) {
+    error("overflow in SECREL relocation in section: " + Sec->getSectionName());
+    return;
+  }
   add32(Off, SecRel);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38020.115934.patch
Type: text/x-patch
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170920/68c9427c/attachment.bin>


More information about the llvm-commits mailing list