mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implement datasize, dataoffset and datacopy for yul interpreter.
This commit is contained in:
committed by
Bhargava Shastry
parent
e99efec085
commit
f113f8e4a0
@@ -80,7 +80,8 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
{
|
||||
yulFuzzerUtil::interpret(
|
||||
os1,
|
||||
stack.parserResult()->code
|
||||
stack.parserResult()->code,
|
||||
*EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion())
|
||||
);
|
||||
}
|
||||
catch (yul::test::StepLimitReached const&)
|
||||
@@ -97,6 +98,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
|
||||
yulFuzzerUtil::interpret(
|
||||
os2,
|
||||
stack.parserResult()->code,
|
||||
*EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion()),
|
||||
(yul::test::yul_fuzzer::yulFuzzerUtil::maxSteps * 1.5)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ using namespace yul::test::yul_fuzzer;
|
||||
void yulFuzzerUtil::interpret(
|
||||
ostream& _os,
|
||||
shared_ptr<yul::Block> _ast,
|
||||
Dialect const& _dialect,
|
||||
size_t _maxSteps,
|
||||
size_t _maxTraceSize,
|
||||
size_t _maxMemory
|
||||
@@ -32,7 +33,7 @@ void yulFuzzerUtil::interpret(
|
||||
state.maxTraceSize = _maxTraceSize;
|
||||
state.maxSteps = _maxSteps;
|
||||
state.maxMemSize = _maxMemory;
|
||||
Interpreter interpreter(state);
|
||||
Interpreter interpreter(state, _dialect);
|
||||
interpreter(*_ast);
|
||||
_os << "Trace:" << endl;
|
||||
for (auto const& line: interpreter.trace())
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <test/tools/yulInterpreter/Interpreter.h>
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
|
||||
namespace yul
|
||||
{
|
||||
@@ -27,6 +28,7 @@ struct yulFuzzerUtil
|
||||
static void interpret(
|
||||
std::ostream& _os,
|
||||
std::shared_ptr<yul::Block> _ast,
|
||||
Dialect const& _dialect,
|
||||
size_t _maxSteps = maxSteps,
|
||||
size_t _maxTraceSize = maxTraceSize,
|
||||
size_t _maxMemory = maxMemory
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
#include <src/libfuzzer/libfuzzer_macro.h>
|
||||
|
||||
#include <libyul/AssemblyStack.h>
|
||||
#include <liblangutil/EVMVersion.h>
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
#include <libyul/Exceptions.h>
|
||||
#include <liblangutil/EVMVersion.h>
|
||||
|
||||
#include <test/tools/ossfuzz/yulFuzzerCommon.h>
|
||||
|
||||
@@ -76,7 +77,8 @@ DEFINE_PROTO_FUZZER(Function const& _input)
|
||||
{
|
||||
yulFuzzerUtil::interpret(
|
||||
os1,
|
||||
stack.parserResult()->code
|
||||
stack.parserResult()->code,
|
||||
*EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion())
|
||||
);
|
||||
}
|
||||
catch (yul::test::StepLimitReached const&)
|
||||
@@ -90,8 +92,10 @@ DEFINE_PROTO_FUZZER(Function const& _input)
|
||||
stack.optimize();
|
||||
try
|
||||
{
|
||||
yulFuzzerUtil::interpret(os2,
|
||||
yulFuzzerUtil::interpret(
|
||||
os2,
|
||||
stack.parserResult()->code,
|
||||
*EVMDialect::strictAssemblyForEVMObjects(langutil::EVMVersion()),
|
||||
(yul::test::yul_fuzzer::yulFuzzerUtil::maxSteps * 1.5)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user