Disallow setting .gas() on .transfer()

This commit is contained in:
Alex Beregszaszi committed 2017-02-24 00:27:36 +00:00
1 parent 59514d8268
commit 4d290e551c
3 files changed
+5 -27

No files matched your search

+4 -8
View File
@@ -620,19 +620,15 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
_functionCall.expression().accept(*this);
// Provide the gas stipend manually at first because we may send zero ether.
// Will be zeroed if we send more than zero ether.
if (!function.gasSet())
m_context << u256(eth::GasCosts::callStipend);
m_context << u256(eth::GasCosts::callStipend);
arguments.front()->accept(*this);
utils().convertType(
*arguments.front()->annotation().type,
*function.parameterTypes().front(), true
);
if (!function.gasSet())
{
// gas <- gas * !value
m_context << Instruction::SWAP1 << Instruction::DUP2;
m_context << Instruction::ISZERO << Instruction::MUL << Instruction::SWAP1;
}
// gas <- gas * !value
m_context << Instruction::SWAP1 << Instruction::DUP2;
m_context << Instruction::ISZERO << Instruction::MUL << Instruction::SWAP1;
appendExternalFunctionCall(
FunctionType(
TypePointers{},