mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
yulRun: Add recursion protection
This commit is contained in:
parent
d10d967008
commit
692a99f891
@ -461,6 +461,9 @@ void ExpressionEvaluator::runExternalCall(evmasm::Instruction _instruction)
|
||||
InterpreterState tmpState;
|
||||
tmpState.calldata = m_state.readMemory(memInOffset, memInSize);
|
||||
tmpState.callvalue = callvalue;
|
||||
tmpState.numInstance = m_state.numInstance + 1;
|
||||
|
||||
yulAssert(tmpState.numInstance < 1024, "Detected more than 1024 recursive calls, aborting...");
|
||||
|
||||
// Create new interpreter for the called contract
|
||||
unique_ptr<Interpreter> newInterpreter = makeInterpreterNew(tmpState, tmpScope);
|
||||
|
@ -107,6 +107,9 @@ struct InterpreterState
|
||||
size_t maxExprNesting = 0;
|
||||
ControlFlowState controlFlowState = ControlFlowState::Default;
|
||||
|
||||
/// Number of the current state instance, used for recursion protection
|
||||
size_t numInstance = 0;
|
||||
|
||||
/// Prints execution trace and non-zero storage to @param _out.
|
||||
/// Flag @param _disableMemoryTrace, if set, does not produce a memory dump. This
|
||||
/// avoids false positives reports by the fuzzer when certain optimizer steps are
|
||||
|
Loading…
Reference in New Issue
Block a user