[llvm] r196560 - Fix a pair of array index checks.

Eric Christopher echristo at gmail.com
Thu Dec 5 18:33:38 PST 2013


Author: echristo
Date: Thu Dec  5 20:33:38 2013
New Revision: 196560

URL: http://llvm.org/viewvc/llvm-project?rev=196560&view=rev
Log:
Fix a pair of array index checks.

Patch by Marius Wachtler.

Modified:
    llvm/trunk/lib/Object/MachOObjectFile.cpp

Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=196560&r1=196559&r2=196560&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Thu Dec  5 20:33:38 2013
@@ -899,7 +899,7 @@ MachOObjectFile::getRelocationTypeName(D
         "GENERIC_RELOC_LOCAL_SECTDIFF",
         "GENERIC_RELOC_TLV" };
 
-      if (RType > 6)
+      if (RType > 5)
         res = "Unknown";
       else
         res = Table[RType];
@@ -962,7 +962,10 @@ MachOObjectFile::getRelocationTypeName(D
         "PPC_RELOC_LO14_SECTDIFF",
         "PPC_RELOC_LOCAL_SECTDIFF" };
 
-      res = Table[RType];
+      if (RType > 15)
+        res = "Unknown";
+      else
+        res = Table[RType];
       break;
     }
     case Triple::UnknownArch:





More information about the llvm-commits mailing list