[PATCH] D25016: [ELF] - Fixed assert fail when symbol table has invalid sh_info value.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 06:59:51 PDT 2016


rafael accepted this revision.
rafael added a comment.
This revision is now accepted and ready to land.

The FirstNonLocal == 0 check LGTM, but please split the other check to another patch.



================
Comment at: ELF/InputFiles.cpp:85
   uint32_t FirstNonLocal = Symtab->sh_info;
-  if (FirstNonLocal > NumSymbols)
+  if (FirstNonLocal == 0 || (FirstNonLocal > NumSymbols))
     fatal(getFilename(this) + ": invalid sh_info in symbol table");
----------------
You don't need the extra ()


================
Comment at: ELF/Writer.cpp:385
     for (SymbolBody *B : F->getLocalSymbols()) {
+      if (!B->IsLocal)
+        fatal(getFilename(F) + ": invalid sh_info in symbol table");
----------------
Please split this to another patch.


https://reviews.llvm.org/D25016





More information about the llvm-commits mailing list