From: Chris Lattner Date: Wed, 7 Nov 2001 20:12:30 +0000 (+0000) Subject: Correct problem that allows indirect function calls X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=070cf5e47ed67ef03cfd551005d6d1834ba51b79;p=oota-llvm.git Correct problem that allows indirect function calls git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1179 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 3541eb8228f..41948c58066 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -806,7 +806,11 @@ void Interpreter::executeCallInst(CallInst *I, ExecutionContext &SF) { for (unsigned i = 1; i < I->getNumOperands(); ++i) ArgVals.push_back(getOperandValue(I->getOperand(i), SF)); - callMethod(I->getCalledMethod(), ArgVals); + // To handle indirect calls, we must get the pointer value from the argument + // and treat it as a method pointer. + GenericValue SRC = getOperandValue(I->getCalledValue(), SF); + + callMethod((Method*)SRC.PointerVal, ArgVals); } static void executePHINode(PHINode *I, ExecutionContext &SF) {