Merge pull request #839 from chriseth/checkcode

BREAKING: Make function calls throw if target does not have code.
This commit is contained in:
chriseth authored and GitHub committed 2016-08-17 16:44:15 +02:00
commit b2507e9f10
3 files changed
+37

No files matched your search

@@ -1524,6 +1524,13 @@ void ExpressionCompiler::appendExternalFunctionCall(
m_context << u256(0);
m_context << dupInstruction(m_context.baseToCurrentStackOffset(contractStackPos));
// Check the the target contract exists (has code) for non-low-level calls.
if (funKind == FunctionKind::External || funKind == FunctionKind::CallCode || funKind == FunctionKind::DelegateCall)
{
m_context << Instruction::DUP1 << Instruction::EXTCODESIZE << Instruction::ISZERO;
m_context.appendConditionalJumpTo(m_context.errorTag());
}
if (_functionType.gasSet())
m_context << dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
else