mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disable mload, msize and functions that call themselves (other forms of recusion are still possible)
This commit is contained in:
parent
614fe9ea9e
commit
851a21ad37
@ -321,6 +321,8 @@ YulOptimizerTestCommon::YulOptimizerTestCommon(
|
||||
}},
|
||||
{"stackLimitEvader", [&]() {
|
||||
disambiguate();
|
||||
FunctionHoister::run(*m_context, *m_ast);
|
||||
CircularReferencesPruner::run(*m_context, *m_ast);
|
||||
StackLimitEvader::run(*m_context, *m_object, CompilabilityChecker{
|
||||
*m_dialect,
|
||||
*m_object,
|
||||
|
@ -129,12 +129,9 @@ DEFINE_PROTO_FUZZER(Program const& _input)
|
||||
EVMDialect::strictAssemblyForEVMObjects(version)
|
||||
);
|
||||
// Run circular references pruner and then stack limit evader.
|
||||
string step = "circularReferencesPruner";
|
||||
string step = "stackLimitEvader";
|
||||
optimizerTest.setStep(step);
|
||||
shared_ptr<solidity::yul::Block> astBlock = optimizerTest.run();
|
||||
step = "stackLimitEvader";
|
||||
optimizerTest.setStep(step);
|
||||
astBlock = optimizerTest.run();
|
||||
string optimisedProgram = Whiskers(R"(
|
||||
object "main" {
|
||||
code {
|
||||
|
@ -573,7 +573,8 @@ void ProtoConverter::visit(UnaryOp const& _x)
|
||||
op == UnaryOp::EXTCODEHASH ||
|
||||
op == UnaryOp::EXTCODESIZE ||
|
||||
op == UnaryOp::BALANCE ||
|
||||
op == UnaryOp::BLOCKHASH
|
||||
op == UnaryOp::BLOCKHASH ||
|
||||
op == UnaryOp::MLOAD
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -659,7 +660,8 @@ void ProtoConverter::visit(NullaryOp const& _x)
|
||||
op == NullaryOp::TIMESTAMP ||
|
||||
op == NullaryOp::NUMBER ||
|
||||
op == NullaryOp::CHAINID ||
|
||||
op == NullaryOp::SELFBALANCE
|
||||
op == NullaryOp::SELFBALANCE ||
|
||||
op == NullaryOp::MSIZE
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -1057,6 +1059,9 @@ optional<string> ProtoConverter::functionExists(NumFunctionReturns _numReturns)
|
||||
|
||||
void ProtoConverter::visit(FunctionCall const& _x, string const& _functionName, bool _expression)
|
||||
{
|
||||
// Disable recursive calls.
|
||||
if (_functionName == m_currentFunctionName)
|
||||
return;
|
||||
yulAssert(m_functionSigMap.count(_functionName), "Proto fuzzer: Invalid function.");
|
||||
auto ret = m_functionSigMap.at(_functionName);
|
||||
unsigned numInParams = ret.first;
|
||||
@ -1721,7 +1726,7 @@ void ProtoConverter::fillFunctionCallInput(unsigned _numInParams)
|
||||
m_output << "calldataload(" << slot << ")";
|
||||
break;
|
||||
case 1:
|
||||
m_output << "mload(" << slot << ")";
|
||||
m_output << "sload(" << slot << ")";
|
||||
break;
|
||||
case 2:
|
||||
m_output << "sload(" << slot << ")";
|
||||
|
Loading…
Reference in New Issue
Block a user