mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Solidity STOPs in case of failed call.
This commit is contained in:
parent
a5b4f18dd7
commit
226c4a89b2
@ -984,9 +984,10 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
|
|||||||
m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
|
m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
|
||||||
else
|
else
|
||||||
// send all gas except for the 21 needed to execute "SUB" and "CALL"
|
// send all gas except for the 21 needed to execute "SUB" and "CALL"
|
||||||
m_context << u256(21) << eth::Instruction::GAS << eth::Instruction::SUB;
|
m_context << u256(_functionType.valueSet() ? 6741 : 41) << eth::Instruction::GAS << eth::Instruction::SUB;
|
||||||
m_context << eth::Instruction::CALL
|
m_context << eth::Instruction::CALL;
|
||||||
<< eth::Instruction::POP; // @todo do not ignore failure indicator
|
auto tag = m_context.appendConditionalJump();
|
||||||
|
m_context << eth::Instruction::STOP << tag; // STOP if CALL leaves 0.
|
||||||
if (_functionType.valueSet())
|
if (_functionType.valueSet())
|
||||||
m_context << eth::Instruction::POP;
|
m_context << eth::Instruction::POP;
|
||||||
if (_functionType.gasSet())
|
if (_functionType.gasSet())
|
||||||
@ -999,10 +1000,12 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
|
|||||||
CompilerUtils(m_context).loadFromMemory(0, *firstType, false, true);
|
CompilerUtils(m_context).loadFromMemory(0, *firstType, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExpressionCompiler::appendArgumentsCopyToMemory(vector<ASTPointer<Expression const>> const& _arguments,
|
void ExpressionCompiler::appendArgumentsCopyToMemory(
|
||||||
|
vector<ASTPointer<Expression const>> const& _arguments,
|
||||||
TypePointers const& _types,
|
TypePointers const& _types,
|
||||||
bool _padToWordBoundaries,
|
bool _padToWordBoundaries,
|
||||||
bool _padExceptionIfFourBytes)
|
bool _padExceptionIfFourBytes
|
||||||
|
)
|
||||||
{
|
{
|
||||||
solAssert(_types.empty() || _types.size() == _arguments.size(), "");
|
solAssert(_types.empty() || _types.size() == _arguments.size(), "");
|
||||||
for (size_t i = 0; i < _arguments.size(); ++i)
|
for (size_t i = 0; i < _arguments.size(); ++i)
|
||||||
|
Loading…
Reference in New Issue
Block a user