From d2f864916c8ca041704c3d8c035b4e4982394ff5 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 13 Apr 2021 12:46:27 +0200 Subject: [PATCH] Disable calldata and return data copy, self destruct. --- test/tools/ossfuzz/YulToEvmDifferentialFuzzer.cpp | 4 ++-- test/tools/ossfuzz/protoToYul.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/tools/ossfuzz/YulToEvmDifferentialFuzzer.cpp b/test/tools/ossfuzz/YulToEvmDifferentialFuzzer.cpp index 07594105f..d0ae00fbe 100644 --- a/test/tools/ossfuzz/YulToEvmDifferentialFuzzer.cpp +++ b/test/tools/ossfuzz/YulToEvmDifferentialFuzzer.cpp @@ -131,7 +131,7 @@ DEFINE_PROTO_FUZZER(Program const& _input) EVMDialect::strictAssemblyForEVMObjects(version) ); // HACK: Force this to fake stack limit evader for now - string step = "fakeStackLimitEvader"; + string step = "stackLimitEvader"; optimizerTest.setStep(step); // optimizerTest.setStep(optimizerTest.randomOptimiserStep(_input.step())); shared_ptr astBlock = optimizerTest.run(); @@ -190,6 +190,6 @@ DEFINE_PROTO_FUZZER(Program const& _input) } solAssert( unoptimizedState.str() == optimizedState.str(), - "State of unoptimised and optimised stack reused code do not match." + "State of unoptimised and optimised stack saver code do not match." ); } diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index e4531099e..0a423c5ec 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -757,7 +757,10 @@ void ProtoConverter::visit(CopyFunc const& _x) // Code copy may change state if e.g., some byte of code // is stored to storage via a sequence of mload and sstore. - if (m_filterStatefulInstructions && type == CopyFunc::CODE) + if ( + m_filterStatefulInstructions && + (type == CopyFunc::CODE || type == CopyFunc::CALLDATA || type == CopyFunc::RETURNDATA) + ) return; switch (type) @@ -1285,7 +1288,8 @@ void ProtoConverter::visit(TerminatingStmt const& _x) visit(_x.ret_rev()); break; case TerminatingStmt::kSelfDes: - visit(_x.self_des()); + if (!m_filterStatefulInstructions) + visit(_x.self_des()); break; case TerminatingStmt::TERM_ONEOF_NOT_SET: break;