Do not read past the end of the contained type list
authorChris Lattner <sabre@nondot.org>
Thu, 9 Oct 2003 20:31:18 +0000 (20:31 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 9 Oct 2003 20:31:18 +0000 (20:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8986 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp

index 1a28e46d8d08b43938e8fad437c81d1fbb9b87fc..aa6679f6e1a6cddfd23292786f44e557dc325a10 100644 (file)
@@ -57,8 +57,8 @@ static ExFunc lookupFunction(const Function *M) {
   // composite function name should be.
   std::string ExtName = "lle_";
   const FunctionType *MT = M->getFunctionType();
-  for (unsigned i = 0; const Type *Ty = MT->getContainedType(i); ++i)
-    ExtName += getTypeID(Ty);
+  for (unsigned i = 0, e = MT->getNumContainedTypes(); i != e; ++i)
+    ExtName += getTypeID(MT->getContainedType(i));
   ExtName += "_" + M->getName();
 
   //std::cout << "Tried: '" << ExtName << "'\n";