[lld] r249736 - Make this test a bit stricter.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 13:29:22 PDT 2015


Author: rafael
Date: Thu Oct  8 15:29:22 2015
New Revision: 249736

URL: http://llvm.org/viewvc/llvm-project?rev=249736&view=rev
Log:
Make this test a bit stricter.

The only way for SecIndex to be zero in here is for an extended section
number to be zero, which would be an error.

Modified:
    lld/trunk/ELF/InputFiles.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=249736&r1=249735&r2=249736&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Oct  8 15:29:22 2015
@@ -169,7 +169,7 @@ SymbolBody *elf2::ObjectFile<ELFT>::crea
     break;
   }
 
-  if (SecIndex >= Sections.size() || (SecIndex != 0 && !Sections[SecIndex]))
+  if (SecIndex >= Sections.size() || !SecIndex || !Sections[SecIndex])
     error("Invalid section index");
 
   switch (Sym->getBinding()) {




More information about the llvm-commits mailing list